'subquery must return only one column' error
See original GitHub issueI have a simple users
table, and a friends
table with foreign keys user_id_1
and user_id_2
.
In a seed, I add some users. In another seed I want to add some friend relationships by doing that.
knex('friends').insert({
user_id_1: knex('users').select('id').where({username: 'bla'}),
user_id_2: knex('users').select('id').where({username: 'blu'}),
})
This gives me back an error that subquery must return only one column
. I select just the id
column, so what is the problem here?
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
error : subquery must return only one column - Stack Overflow
@user2431581, You are defining field MyField via a sub query. When you do that the sub query must only return one value and...
Read more >ERROR: subquery must return only one column
All elements of an array must have the same type; when constructing an array with a subquery, the simplest way to enforce this...
Read more >No way to debug "subquery must return only one column" error
The main reason is that this error occurs when an expression subquery returns more than one row when it is not expected. In...
Read more >PostgreSQL error: subquery must return only one column ...
Coding example for the question PostgreSQL error: subquery must return only one column-postgresql.
Read more >#28664 (basic subquery generates invalid sql) – Django
The subquery is selecting all columns, causing django.db.utils.ProgrammingError: subquery must return only one column. Oldest first. Newest first. Threaded.
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
@coockoo looks like you are right https://runkit.com/embed/htzh2gkncj8n I was running 0.12.6 which still generated invalid output.
it was faulty code indeed, and thats why i answered it, for future reference 😄
good to know about
clearSelect
. well, i dont know if it should clear by default or no. i just thought i will ask, to know, if people know the reason, or to start a conversation, if people dont know the reason. i guess it makes send to have it explicitly like it is now.thank you for your answer 😃