multiple sql statements in an sql script file
melbardis opened this issue · 4 comments
melbardis commented
hi
in a script, executed using the 'sql' command.
if you have one sql statement, like select resetDB(), you get back the result of the select, very nicely
Query: [resetDB] SELECT resetDB();
{ id: '8fdb0a61-59a5-40ea-bcc0-f3f53830ff55',
sql:
'SELECT resetDB();\r\n',
start: 1529527970119,
name: 'resetDB',
params: undefined,
end: 1529527970237,
duration: 118,
data: { row_count: 1, rows: [ [Object] ], command: 'SELECT' } }
Result: [resetDB] (118ms ) 1 row(s)
= [ { resetdb: '' } ]
if you have more than one, you get back a result with all nulls (row_count, etc ...)
Query: [resetDB] SELECT resetDB();
insert into types (is_type, name) values ('obj', 'e') returning * ;
result event: context
{ id: 'c8aedfe2-7da9-4220-a95e-0b993c244f2d',
sql:
'SELECT resetDB();\r\n',
start: 1529527770306,
name: 'resetDB',
params: undefined,
end: 1529527770408,
duration: 102,
error: null,
data:
{ row_count: undefined, rows: undefined, command: undefined } }
Result: [resetDB] (102ms ) undefined row(s)
Note: the result in the database is as expected, just the result returned to the caller is not..
dynajoe commented
I think support for multiple query results is a new thing in node pg. I will look to see how they've implemented it.
dynajoe commented
What version of postgres are you using?
melbardis commented
hi
i am using the postgres 10.4
…On Wed, Jul 4, 2018 at 10:34 AM, Joe Andaverde ***@***.***> wrote:
Started work on supporting multiple statements:
#12 <#12>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AhAzA6TaQ-CEEQtdv7oL0ZRpyJLlCohKks5uDPyugaJpZM4Uv-4D>
.