You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Likely related to #76 my intuitive notion of sql.file was that I am able to execute arbitrary SQL files. However, at the moment it looks like postgress will attempt to wrap everything in a prepared statement that does not support more than one statement?
Example create.sql file:
CREATETABLEfoo (
id numeric
);
CREATETABLEbar (
id numeric
);
Executing this one fails on the postgres side with:
PostgresError: cannot insert multiple commands into a prepared statement
I'm on v2.0.0-beta.0 but the issue exists on v1.0.0, too.
The text was updated successfully, but these errors were encountered:
The query will be executed as a simple query if you don't pass a second argument to sql.file().
The postgres protocol doesn't allow passing parameters in simple queries so you can't have multiple statements in the same file while also using positional parameters.
I would think that if you get the above error it is because you run it like this:
sql.file('create.sql',[])
Try removing any arguments but the filename and run it like this:
Likely related to #76 my intuitive notion of
sql.file
was that I am able to execute arbitrary SQL files. However, at the moment it looks like postgress will attempt to wrap everything in a prepared statement that does not support more than one statement?Example
create.sql
file:Executing this one fails on the postgres side with:
I'm on v2.0.0-beta.0 but the issue exists on v1.0.0, too.
The text was updated successfully, but these errors were encountered: