[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] PostGIS and prepared statement, data_type problem
From: Marco Boeringa <marco () boeringa ! demon ! nl>
Date: 2022-04-09 13:58:14
Message-ID: b589ef42-de24-3d4b-8dcc-55bb4b61dcf4 () boeringa ! demon ! nl
[Download RAW message or body]
I finally got this to work by switching to WKB and "ST_GeomFromWKB" and
specifying data_type for the column as 'geometry'.
Op 9-4-2022 om 11:47 schreef Marco Boeringa:
> 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
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic