[postgis-users] PostGIS and prepared statement, data_type problem
Marco Boeringa
marco at boeringa.demon.nl
Sat Apr 9 02:47:03 PDT 2022
Hi all,
Reading this PostgreSQL page about prepared SQL statements:
https://www.postgresql.org/docs/current/sql-prepare.html
it suggests that 'data_type' is optional, and "will be inferred from the
context in which the parameter is first referenced" if unspecified.
Now I have attempted to create a prepared SQL statement for doing
INSERTs, which includes an "ST_GeometryFromText()" function call that
will get WKT inserted in the geometry field of the target table.
However, this fails with a "could not determine data type of parameter
$1" error for the geometry field.
Is there something PostGIS functions do not expose to PostgreSQL that
causes PostgreSQL to fail to "infer from context" the field type? Or is
this a general issue with PREPAREd statements if they include any
function call, whether PostGIS or core PostgreSQL, and are you always
required to specify data type in this context?
Marco
More information about the postgis-users
mailing list