Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
On 05/01/2017 05:04 PM, Max Wang wrote: Hi Adrian, Thank you. The strange things is we only use Python do insert/update/delete and do not run other SQL command. The evidence says otherwise, which leads to: So nothing ever pulls data out of the database with SELECTS? There is no monitoring

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was changed to 1 On 05/01/2017 04:29 PM, Max Wang wrote: > Hi Adrian, > > I checked and found > > is_cycled | f Hmm. A possible cause: test=# insert into serial_test (fld_1) values ('test'); INSE

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Melvin Davidson
t; Can you do that on the serial column from one the affected tables and post > the results here? > > > > > Thanks. > > Regards, > Max > > -Original Message- > From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] > Sent: Tuesday, 2 May 2017 9:31 A

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
On 05/01/2017 04:55 PM, Max Wang wrote: Hi Melvin, I already reset id to correct value after this happen. This is a production database. We could not stop and wait for trouble shooting. I manually reset sequence of id to correct value. I would grep for setval in any of the code you have

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
c: Max Wang <mw...@1080agile.com>; Amitabh Kant <amitabhk...@gmail.com>; pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was changed to 1 On Mon, May 1, 2017 at 7:45 PM, Adrian Klaver <adrian.kla...@aklaver.com<mailto:adrian.kla...@aklaver.com>> wrot

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
ct: Re: [GENERAL] all serial type was changed to 1 On 05/01/2017 04:08 PM, Max Wang wrote: Hi Adrian, Only sequences (id) reset to 1. Then per Amitabh Kant's suggestion take a look at the cycle setting for the sequences. For sequence named ts_stamp_test_id_seq: test=# select * from ts_s

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Melvin Davidson
l Message- >> From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] >> Sent: Tuesday, 2 May 2017 9:31 AM >> To: Max Wang <mw...@1080agile.com>; Amitabh Kant <amitabhk...@gmail.com> >> Cc: pgsql-general@postgresql.org >> Subject: Re: [GENERAL] all serial

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
AM To: Max Wang <mw...@1080agile.com>; Amitabh Kant <amitabhk...@gmail.com> Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was changed to 1 On 05/01/2017 04:11 PM, Max Wang wrote: Hi Amitabh, Thank you for suggestion. We did not reach the limit of serial type

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
...@aklaver.com] Sent: Tuesday, 2 May 2017 9:31 AM To: Max Wang <mw...@1080agile.com>; Amitabh Kant <amitabhk...@gmail.com> Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was changed to 1 On 05/01/2017 04:11 PM, Max Wang wrote: > Hi Amitabh, > > > > Thank

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Melvin Davidson
On Mon, May 1, 2017 at 7:31 PM, Adrian Klaver wrote: > On 05/01/2017 04:11 PM, Max Wang wrote: > >> Hi Amitabh, >> >> >> >> Thank you for suggestion. We did not reach the limit of serial type. >> Some tables only have hundreds of rows. >> > > It would helpful if you

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
On 05/01/2017 04:11 PM, Max Wang wrote: Hi Amitabh, Thank you for suggestion. We did not reach the limit of serial type. Some tables only have hundreds of rows. It would helpful if you ran the query I showed in my previous post on one the sequences just so we can see. From subsequent

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
Hi Adrian, I checked and found is_cycled | f Regards, Max -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Tuesday, 2 May 2017 9:16 AM To: Max Wang <mw...@1080agile.com>; pgsql-general@postgresql.org Subject: Re: [GENERAL] all seria

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Rob Sargent
laver.com>; pgsql-general@postgresql.org *Subject:* Re: [GENERAL] all serial type was changed to 1 On Mon, May 1, 2017 at 7:08 PM, Max Wang <mw...@1080agile.com <mailto:mw...@1080agile.com>> wrote: Hi Adrian, Only sequences (id) reset to 1. Regards, Max

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
o:adrian.kla...@aklaver.com>] Sent: Monday, 1 May 2017 11:30 PM To: Max Wang <mw...@1080agile.com<mailto:mw...@1080agile.com>>; pgsql-general@postgresql.org<mailto:pgsql-general@postgresql.org> Subject: Re: [GENERAL] all serial type was changed to 1 On 04/30/2017 10:51 PM, Max Wa

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
On 05/01/2017 04:08 PM, Max Wang wrote: Hi Adrian, Only sequences (id) reset to 1. Then per Amitabh Kant's suggestion take a look at the cycle setting for the sequences. For sequence named ts_stamp_test_id_seq: test=# select * from ts_stamp_test_id_seq ; -[ RECORD 1

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Melvin Davidson
> To: Max Wang <mw...@1080agile.com>; pgsql-general@postgresql.org > Subject: Re: [GENERAL] all serial type was changed to 1 > > On 04/30/2017 10:51 PM, Max Wang wrote: > > Hi All, > > > > > > > > We have a PostgreSQL database. There are 26 tables

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
ubject: Re: [GENERAL] all serial type was changed to 1 On Mon, May 1, 2017 at 11:21 AM, Max Wang <mw...@1080agile.com<mailto:mw...@1080agile.com>> wrote: Hi All, We have a PostgreSQL database. There are 26 tables and we use serial type as primary key. We had a insert error as “d

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
Hi Adrian, Only sequences (id) reset to 1. Regards, Max -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Monday, 1 May 2017 11:30 PM To: Max Wang <mw...@1080agile.com>; pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was change

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Max Wang
pgsql-general@postgresql.org Subject: Re: [GENERAL] all serial type was changed to 1 On 1 May 2017 at 17:51, Max Wang <mw...@1080agile.com> wrote: > We have a PostgreSQL database. There are 26 tables and we use serial > type as primary key. We had a insert error as “duplicate key

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Adrian Klaver
On 04/30/2017 10:51 PM, Max Wang wrote: Hi All, We have a PostgreSQL database. There are 26 tables and we use serial type as primary key. We had a insert error as “duplicate key value violates unique constraint, DETAIL: Key (id)=(1) already exists.” one weeks ago. I checked and found all

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread David Rowley
On 1 May 2017 at 17:51, Max Wang wrote: > We have a PostgreSQL database. There are 26 tables and we use serial type as > primary key. We had a insert error as “duplicate key value violates unique > constraint, DETAIL: Key (id)=(1) already exists.” one weeks ago. I checked >

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Amitabh Kant
On Mon, May 1, 2017 at 11:21 AM, Max Wang wrote: > Hi All, > > > > We have a PostgreSQL database. There are 26 tables and we use serial type > as primary key. We had a insert error as “duplicate key value violates > unique constraint, DETAIL: Key (id)=(1) already exists.”

Re: [GENERAL] all serial type was changed to 1

2017-05-01 Thread Peter Geoghegan
On Sun, Apr 30, 2017 at 10:51 PM, Max Wang wrote: > We have a PostgreSQL database. There are 26 tables and we use serial type as > primary key. We had a insert error as “duplicate key value violates unique > constraint, DETAIL: Key (id)=(1) already exists.” one weeks ago. I

[GENERAL] all serial type was changed to 1

2017-04-30 Thread Max Wang
Hi All, We have a PostgreSQL database. There are 26 tables and we use serial type as primary key. We had a insert error as "duplicate key value violates unique constraint, DETAIL: Key (id)=(1) already exists." one weeks ago. I checked and found all tables' id were reset to 1. I checked

[GENERAL] Resetting serial type after delete from table

2010-05-08 Thread John Gage
If I delete from table, which table contains a serial type field, and then insert new rows into the table excluding the [serial] column from the list of columns in the INSERT statement, the numbers in the serial column resume where they left off prior to the delete from table: 639, 640,

Re: [GENERAL] Resetting serial type after delete from table

2010-05-08 Thread Leif Biberg Kristensen
On Saturday 8. May 2010 10.11.32 John Gage wrote: If I delete from table, which table contains a serial type field, and then insert new rows into the table excluding the [serial] column from the list of columns in the INSERT statement, the numbers in the serial column resume where they

Re: [GENERAL] Resetting serial type after delete from table

2010-05-08 Thread John Gage
Thanks very, very much. I got as far as 8.1.4 and did not find 9.15. May I suggest that the documentation have an index entry under serial for 9.15, which is a major heading whereas 8.1.4 is a minor heading and has its own index entry? This is said from the perspective of awe for the

[GENERAL] No serial type

2008-11-18 Thread Simon Connah
Hi, I've just started using PostgreSQL and have been reading up on it. Part of what I wanted to do was to have a column which automatically incremented itself by one every time I do an INSERT. From reading the manual I was lead to believe that the correct type for this was either serial

Re: [GENERAL] No serial type

2008-11-18 Thread Scott Marlowe
On Tue, Nov 18, 2008 at 10:24 AM, Simon Connah [EMAIL PROTECTED] wrote: Hi, I've just started using PostgreSQL and have been reading up on it. Part of what I wanted to do was to have a column which automatically incremented itself by one every time I do an INSERT. From reading the manual I was

Re: [GENERAL] No serial type

2008-11-18 Thread Raymond O'Donnell
On 18/11/2008 17:37, Scott Marlowe wrote: create table a (i int primary key, info text); create sequence a_i_seq; alter table a alter column i set default nextval('a_i_seq'); You'll also need to grant SELECT and UPDATE permissions on the sequence to the user that'll be INSERTing into the

Re: [GENERAL] No serial type

2008-11-18 Thread Simon Connah
On 18 Nov 2008, at 17:40, Raymond O'Donnell wrote: On 18/11/2008 17:37, Scott Marlowe wrote: create table a (i int primary key, info text); create sequence a_i_seq; alter table a alter column i set default nextval('a_i_seq'); You'll also need to grant SELECT and UPDATE permissions on the

Re: [GENERAL] No serial type

2008-11-18 Thread Tom Lane
Scott Marlowe [EMAIL PROTECTED] writes: On Tue, Nov 18, 2008 at 10:24 AM, Simon Connah [EMAIL PROTECTED] wrote: But whenever I try and update my column to this type it says that it can not find that data type. Am I doing something wrong? Serial is a pseudotype. Perhaps better to say it's a

Re: [GENERAL] No serial type

2008-11-18 Thread Christian Schröder
Scott Marlowe wrote: Serial is a pseudotype. It represents creating an int or bigint and a sequence then assigning a default value for the column and setting dependency in the db so the sequence will be dropped when the table gets dropped. If you don't want to recreate the table, you can do

Re: [GENERAL] No serial type

2008-11-18 Thread Erik Jones
On Nov 18, 2008, at 10:37 AM, Tom Lane wrote: Scott Marlowe [EMAIL PROTECTED] writes: On Tue, Nov 18, 2008 at 10:24 AM, Simon Connah [EMAIL PROTECTED] wrote: But whenever I try and update my column to this type it says that it can not find that data type. Am I doing something wrong?

[GENERAL] Referencing Serial Type as Foreign Key

2005-06-03 Thread Rich Shepard
Don't know why I've not come across this before, but I have now. In a table definition I reference the primary key of another table. That key is of datatype SERIAL. In the referencing table, do I define the column as col_name INTEGER REFERENCES other-table (primary_key_field), or is the

Re: [GENERAL] Referencing Serial Type as Foreign Key

2005-06-03 Thread Joshua D. Drake
Rich Shepard wrote: Don't know why I've not come across this before, but I have now. In a table definition I reference the primary key of another table. That key is of datatype SERIAL. In the referencing table, do I define the column as col_name INTEGER REFERENCES other-table

Re: [GENERAL] Referencing Serial Type as Foreign Key

2005-06-03 Thread Rich Shepard
On Fri, 3 Jun 2005, Joshua D. Drake wrote: Serial is a psuedo type to integer/big (depending on the type of serial). Josh, That's what I thought. What you have above should work fine. OK. Many thanks, Rich -- Dr. Richard B. Shepard, President Applied Ecosystem Services, Inc. (TM)