Comments (11)
Hi. Great error report! Thank you!
I think your expectations are correct, so that's quite the bug you've found here. I'll dig into it.
from postgres.
Ok, I found the issue. It was accidentally trying to use the routineRetry logic for simple queries (should only be used for prepared statements), which makes no sense, and messes with the protocol expectations for simple queries.
You can try it out by installing latest master using npm i porsager/postgres
Related to your issue 2, you have a stray "async" for your function. The function should look like this:
import postgres from 'postgres'
const sql = postgres({ max: 1 });
await sql.begin(sql => [
sql`
CREATE TABLE user_permissions (
permissions TEXT[] NOT NULL
)
`,
sql`
INSERT INTO user_permissions (permissions)
VALUES (('read', 'write', 'delete'))
`,
]);
await sql.end();
from postgres.
This is awesome, thank you for the quick fix!
from postgres.
You can try it out by installing latest master using npm i porsager/postgres
@porsager I just tried, but the issue still reproduces for me on tip-of-tree. I tried cloning & building the repository, but no luck!
from postgres.
Didn't transpile for cjs etc, so if you're not using the esm version that might be it. Just a sec 😊
from postgres.
Try again now 😉
from postgres.
If there's still an error, do post it 👍
from postgres.
Still no luck; here's the exact thing that I try: https://github.com/aslushnikov/postgres-js-issue-repro
To validate the repro, there's a commented-out node-postgres
code snippet that does throw an error:
from postgres.
To make sure this is not something specific to my machine, here are Github Actions running this test: https://github.com/aslushnikov/postgres-js-issue-repro/actions/runs/8364618788/job/22900381583
from postgres.
There we go :-) Single character mistake - sorry
from postgres.
@porsager awesome, it works now!
I had to build it manually since installation from GH doesn't work. That's not an issue for me though – i'll happily wait for the next release.
Thank you!
from postgres.
Related Issues (20)
- PostgresError: syntax error at or near "$1" HOT 1
- Possible issue with cloudflare workers caused by a canceled promise HOT 2
- PostgresJS Prevents Natural Process Exit
- Mass Update JSONB Error
- TimeZone on connection
- Problem with inserting big numbers (more than 64bit) HOT 1
- Cannot use value interpolation within a COPY query HOT 2
- TypeError setting up client HOT 1
- Query Hooks HOT 1
- Feature request: dynamic username support for credential rotation HOT 1
- BUG: Interpolation issue while query building HOT 3
- Cloudflare: I/O Error HOT 1
- feat: support 'using' syntax and [Symbol.dispose]
- Getting Inserted id HOT 2
- Transforming undefined to `DEFAULT` HOT 1
- BUG: inconsistent behaviour inserting multiple records with implicit column names and some properties undefined.
- [BUG] Escape character in url string
- Strings with apostrophe are not properly escaped
- BUG: All further queries hang if transaction scoped sql parameter is not used in some queries [with reproduction code]
- AS in Dynamic Fields Selection Not Working HOT 2
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.