Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Thom Brown
On 20 September 2010 20:58, Merlin Moncure wrote: > On Mon, Sep 20, 2010 at 10:08 AM, Thom Brown wrote: >> On 20 September 2010 14:53, Carlos Mennens wrote: >>> I have a table in my database and would like to modify the one column >>> that is already configured to be the PRIMARY KEY but I forgot

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Merlin Moncure
On Mon, Sep 20, 2010 at 10:08 AM, Thom Brown wrote: > On 20 September 2010 14:53, Carlos Mennens wrote: >> I have a table in my database and would like to modify the one column >> that is already configured to be the PRIMARY KEY but I forgot to set >> it for AUTO_INCREMENT. For some reason I can'

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Carlos Mennens
Thanks all! I understand the concept now. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Thom Brown
On 20 September 2010 19:54, Carlos Mennens wrote: > On Mon, Sep 20, 2010 at 2:43 PM, A.M. wrote: >> DEFAULT > > Sorry just to be clear you're saying that I need to enter the command as: > > INSERT INTO table_name DEFAULT VALUES ( > 'data', > 'data', > 'data', > 'data', > '2010-09-20' > ); > Well

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Adrian Klaver
On 09/20/2010 11:40 AM, Carlos Mennens wrote: On Mon, Sep 20, 2010 at 10:08 AM, Thom Brown wrote: CREATE SEQUENCE seq_blades_id; SELECT setval('seq_blades_id', max(id)) FROM blades; -- set the sequence's value to the maximum value of "id" ALTER TABLE blades ALTER COLUMN id SET DEFAULT nextval('

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Thom Brown
On 20 September 2010 19:40, Carlos Mennens wrote: > On Mon, Sep 20, 2010 at 10:08 AM, Thom Brown wrote: >> CREATE SEQUENCE seq_blades_id; >> SELECT setval('seq_blades_id', max(id)) FROM blades; -- set the >> sequence's value to the maximum value of "id" >> ALTER TABLE blades ALTER COLUMN id SET D

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Carlos Mennens
On Mon, Sep 20, 2010 at 2:43 PM, A.M. wrote: > DEFAULT Sorry just to be clear you're saying that I need to enter the command as: INSERT INTO table_name DEFAULT VALUES ( 'data', 'data', 'data', 'data', '2010-09-20' ); Or does the 'DEFAULT' value go in ( )? -- Sent via pgsql-general mailing lis

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Carlos Mennens
On Mon, Sep 20, 2010 at 10:08 AM, Thom Brown wrote: > CREATE SEQUENCE seq_blades_id; > SELECT setval('seq_blades_id', max(id)) FROM blades; -- set the > sequence's value to the maximum value of "id" > ALTER TABLE blades ALTER COLUMN id SET DEFAULT > nextval('seq_blades_id'); -- make default value

Re: [GENERAL] Alter Table Auto_Increment

2010-09-20 Thread Thom Brown
On 20 September 2010 14:53, Carlos Mennens wrote: > I have a table in my database and would like to modify the one column > that is already configured to be the PRIMARY KEY but I forgot to set > it for AUTO_INCREMENT. For some reason I can't find what the proper > command would be in the documenta