question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"insert into select" support (todo: array-mode iteration error)

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
oguimbalcommented, Jan 30, 2021

I couldnt find any time to work on that this week, but it’s almost done. I’ll keep you posted, hopefully next week.

2reactions
oguimbalcommented, Jan 14, 2021

Yup… insert into select is not implemented (thanks, procrastination)… I’ll do that soon.

Thanks for the report

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found