"insert into select" support (todo: array-mode iteration error)
See original GitHub issueThis is code express-session appears to use. Support for this would certainly be nice 👍 although it seems a bit complicated. I’m not sure what the point of an inner SELECT query is here since it is not actually looking up values from elsewhere but just providing them directly, but somebody better versed in SQL might know why this is clever.
Error: todo: array-mode iteration
*️⃣ Failed SQL statement: INSERT INTO "express_server_sessions" (sess, expire, sid) SELECT '{"cookie":{"originalMaxAge":1296000000,"expires":"2021-01-29T15:49:27.925Z","secure":true,"httpOnly":true,"path":"/"},"passport":{"user":653646}}', to_timestamp(1611935368), 'jCUSxo0EnzcIeCQYUgt6g3FQCoIO6Q3S' ON CONFLICT (sid) DO UPDATE SET sess='{"cookie":{"originalMaxAge":1296000000,"expires":"2021-01-29T15:49:27.925Z","secure":true,"httpOnly":true,"path":"/"},"passport":{"user":653646}}', expire=to_timestamp(1611935368) RETURNING sid;
PS: to run this code in the first place I had to work around the lack of to_timestamp:
const pgMem = require('pg-mem');
const mockDb = pgMem.newDb();
mockDb.public.registerFunction({
name: 'to_timestamp',
args: [pgMem.DataType.integer],
returns: pgMem.DataType.timestampz,
implementation: input => {
return new Date(input * 1000).toISOString();
},
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
mysql - Insert into select statement produces #1064 error
I think you want something like this. INSERT INTO members (`name`, `email`,`password`,`salt`) SELECT 'Prep','name@email.co.uk', password, ...
Read more >INSERT INTO SELECT statement overview and examples
We get the following error message. This error comes because of the column mismatch between the source table and destination table. SQL Server ......
Read more >MySQL 8.0 Reference Manual :: 13.2.7.1 INSERT ... SELECT ...
With INSERT ... SELECT , you can quickly insert many rows into a table from the result of a SELECT statement, which can...
Read more >Example: Insert Using a SELECT Subquery - Teradata Database
INSERT INTO promotion (deptnum, empname, yearsexp) SELECT dept... ... Unexpected Row Length Errors: Sorting and Default Sort Order ...
Read more >INSERT - Oracle Help Center
For you to insert rows into a table, the table must be in your own schema or you ... INSERT in the same...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I couldnt find any time to work on that this week, but it’s almost done. I’ll keep you posted, hopefully next week.
Yup…
insert into selectis not implemented (thanks, procrastination)… I’ll do that soon.Thanks for the report