Comments (4)
I think I might be hitting the same problem when using prepared statements:
await sql`PREPARE prep(integer) AS SELECT $1`;
// This works
await sql`EXECUTE prep(0)`;
// This fails with PostgresError: could not determine data type of parameter $1
await sql`EXECUTE prep(${0})`;
// This also fails the same way
await sql`EXECUTE prep(${0}::integer)`;
from postgres.
Turns out I have to use sql.unsafe
Here is my code
sql`alter table draft.${sql(draftName)} alter column geom type geometry(${sql.unsafe( geometryType, )}, 4326) using ST_Transform(ST_SetSRID(geom, ${sql.unsafe(srid)}),4326);`
from postgres.
Have you fixed it? I am having the same error with postgis
from postgres.
SELECT * ST_DistanceSphere( ST_SetSRID(ST_MakePoint(${lng}, ${lat}), 4326), coords ) as distance FROM "MyTable" WHERE ST_DistanceSphere( ST_SetSRID(ST_MakePoint(${lng}, ${lat}), 4326), coords ) < ${radius}
I solved it this way Would you like to give it a try?
from postgres.
Related Issues (20)
- arbitrary stuck queries HOT 6
- Next.js: Error: A "use server" file can only export async functions. Found "sql" that is not an async function. HOT 2
- Certain transaction errors are swallowed HOT 11
- Invalid URL on README (TypeScript + Cypress) HOT 4
- Setting max: undefined results in only 1 connection being created
- ERROR: could not load library HOT 2
- Inserting raster data?
- Unable to insert values of type `bigint[]`
- Error while inserting a JSON array (if object contains the key "type")
- Not available on jsr.io HOT 1
- Unable to connect to postgres DB from Keycloak which is FIPS enabled HOT 1
- Parameter type inference not working for VALUES tables? HOT 2
- Migration script hangs after upgrading to [email protected] HOT 1
- How to concatinate multiple partial statements HOT 2
- how to run a subquery with a variable or call function to generate HOT 3
- Migrating from "brianc/node-postgres" to "porsager/postgres" HOT 1
- dynamic column selection with column naming alias is not working HOT 1
- where clause in delete statement with cte not working as expected HOT 1
- CONNECT_TIMEOUT error HOT 1
- Postgres Issue: duplicate key value violates unique constraint "migration_unique_version" [closed] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgres.