Reputation: 51
I've got an issue finding what's wrong with my insert statement.
INSERT INTO schema.table2(champ2)
SELECT table1.champ.1
FROM schema.table1, schema.table2
It often returns me "Query returned successfully" but with "INSERT 0 0". How can I possibly find the error ?
NB: Some queries worked between these two tables. And sometimes the exact same ones return "INSERT 0 0". I'm just lost and pgadmin won't return me explanations..
Upvotes: 1
Views: 1844
Reputation: 51
Sorry for this post. Solution seems basic.
Adding "table2" in FROM (i.e. the table I'm inserting into) makes my select statement empty..
Thanks for your answers !
Upvotes: 1
Reputation: 15905
When it's failing to insert into schema.table2(champ2) please execute select part of the statement to know whether there the statement actually returns any row or not.
Execute:
SELECT table1.champ1 FROM schema.table1, schema.table2
Upvotes: 0