INSERT with SELECT not working in pgAdmin

Started by Stefan Wildover 15 years ago2 messagesgeneral
Jump to latest
#1Stefan Wild
wilds81@yahoo.de

Hi guys,

I'm trying to merge two tables to one with INSERT and SELECT commands:

INSERT into c_transactions (timestamp) SELECT entrytimestamp from c_transactions

INSERT into c_transactions (timestamp) SELECT exittimestamp from c_transactions

But getting this error on execution (in pgAdmin): "ERROR: null value in column "id" violates not-null constraint
SQL Status:23502"

What I'm doing wrong or is there another possibility for table merging?

I'm using postgres 8.3.

Thanks.

#2Dmitriy Igrishin
dmitigr@gmail.com
In reply to: Stefan Wild (#1)
Re: INSERT with SELECT not working in pgAdmin

Hey Stefan,

The sounds like you have a field "id" in you "c_transactions" without
default value (which usually should be nextval('some_sequence'::regclass).
Do you create a sequence for "c_transactions"."id" ?

--
Regards,
Dmitriy