Re: [GENERAL] Serial initial and incremental value

2015-09-02 Thread Thomas Kellerer
FarjadFarid(ChkNet) schrieb am 02.09.2015 um 11:05: > How can I obtain the initial and incremental value of a serial entity? You can use: select * from sequence_name; where "sequence_name" is the name of the sequence associated with your column. Thomas -- Sent via pgsql-general mai

[GENERAL] Serial initial and incremental value

2015-09-02 Thread FarjadFarid(ChkNet)
Sorry folks, I should have included this in my last question. How can I obtain the initial and incremental value of a serial entity? Many thanks Best Regards Farjad Farid

Re: [GENERAL] serial- sequence priveleges

2012-03-16 Thread Adrian Klaver
On 03/16/2012 08:00 AM, salah jubeh wrote: Hello Adrian, Sorry, I was not clear. what I meant is that. GRANT INSERT, UPDATE ON tablenaem TO USER; -- leads to GRANT ALL ON TABLE tablename_colname_seq TO USER Another thought you do not happen to have DEFAULT PRIVILEGES set up for sequences:

Re: [GENERAL] serial- sequence priveleges

2012-03-16 Thread Adrian Klaver
On 03/16/2012 08:00 AM, salah jubeh wrote: Hello Adrian, Sorry, I was not clear. what I meant is that. GRANT INSERT, UPDATE ON tablenaem TO USER; -- leads to GRANT ALL ON TABLE tablename_colname_seq TO USER CCing the list. Still not following. What version of Postgres are you using? Using 9.

Re: [GENERAL] serial- sequence priveleges

2012-03-16 Thread Adrian Klaver
On 03/16/2012 07:06 AM, salah jubeh wrote: Hello, When creating a serial, a sequence is created automatically. CREATE TABLEtablename ( colname SERIAL ); CREATE SEQUENCE tablename_colname_seq; CREATE TABLE tablename ( colname integer NOT NULL DEFAULT nextval('tablename_colname_seq')

[GENERAL] serial- sequence priveleges

2012-03-16 Thread salah jubeh
Hello, When creating a serial, a sequence is created automatically. CREATE TABLE tablename ( colname SERIAL ); CREATE SEQUENCE tablename_colname_seq; CREATE TABLE tablename ( colname integer NOT NULL DEFAULT nextval('tablename_colname_seq') ); ALTER SEQUENCE tablename_colname_seq OWNED BY tablen

Re: [GENERAL] Serial Vs Sequence

2011-01-31 Thread John R Pierce
On 01/31/11 10:55 PM, Adarsh Sharma wrote: Dear all, I am not able to distinct these two datatypes ( Serial and Sequence ) in Postgresql which resembles like auto-increment in Mysql. Which one gets priority and When ? The only thing I am able to find is to use SERIAL because if a drop table

Re: [GENERAL] Serial Vs Sequence

2011-01-31 Thread Pavel Stehule
Hello SEQUENCE isn't datatype. It is a database object. Simple object, that can to generate unique integer numbers. SERIAL is a fictive datatype. It can create a own SEQUENCE object and can create a reference on this object. pavel=# create sequence ; CREATE SEQUENCE Time: 461.883 ms pavel=#

[GENERAL] Serial Vs Sequence

2011-01-31 Thread Adarsh Sharma
Dear all, I am not able to distinct these two datatypes ( Serial and Sequence ) in Postgresql which resembles like auto-increment in Mysql. Which one gets priority and When ? The only thing I am able to find is to use SERIAL because if a drop table occurs , still SEQUENCE memory is not freed

Re: [GENERAL] Serial key mismatch in master and slave, while using slony

2010-12-20 Thread Vick Khera
On Sat, Dec 18, 2010 at 7:12 AM, Vishnu S. wrote: > I am using Slony-I slony-I-2.0.2 in windows .I have a master and a slave > machine. The replication is working fine. When the master switches to slave > , there exists a serial key mismatch in master and slave machines. So > insertion fails in th

[GENERAL] Serial key mismatch in master and slave, while using slony

2010-12-18 Thread Vishnu S.
Hi, I am using Slony-I slony-I-2.0.2 in windows .I have a master and a slave machine. The replication is working fine. When the master switches to slave , there exists a serial key mismatch in master and slave machines. So insertion fails in the slave machines. I am using the failover comman

Re: [GENERAL] serial columns with replication/cluster

2010-02-04 Thread Jorge Godoy
Sean, take a look at UUID type. It might suit you better than serial. Changing the increment also works, but puts a lot of restrictions on you (such as planning to prevent collision, having to change the increment on several nodes when adding a new node, etc.). Regards, -- Jorge Godoy O

[GENERAL] serial columns with replication/cluster

2010-02-04 Thread Sean Hsien
Dear all, At work we're considering using postgres in a cluster. But I am wondering what implications does multi-master write replication have on auto-incrementing serial columns? E.g. Do we need to fiddle with the increment amount depending on the number of nodes we have? -- Thanks and regards,

Re: [GENERAL] Serial Jumping

2009-02-01 Thread Jasen Betts
On 2009-01-27, db.subscripti...@shepherdhill.biz wrote: > Hi, > > I have a table with BIG SERIAL field as Primary KEY. During high load, > entries in the BIG SERIAL field are jumped. One could see a row with > 1367 and expecting the next INSERT to be 1368, one would end up > getting 1369. > > Ple

Re: [GENERAL] Serial Jumping

2009-01-27 Thread Devrim GÜNDÜZ
On Tue, 2009-01-27 at 05:55 +0100, db.subscripti...@shepherdhill.biz wrote: > I have a table with BIG SERIAL field as Primary KEY. During high load, > entries in the BIG SERIAL field are jumped. One could see a row with > 1367 and expecting the next INSERT to be 1368, one would end up > getting 13

Re: [GENERAL] Serial Jumping

2009-01-26 Thread A. Kretschmer
In response to db.subscripti...@shepherdhill.biz : > Hi, > > I have a table with BIG SERIAL field as Primary KEY. During high load, > entries in the BIG SERIAL field are jumped. One could see a row with > 1367 and expecting the next INSERT to be 1368, one would end up > getting 1369. > > Please i

Re: [GENERAL] Serial Jumping

2009-01-26 Thread Craig Ringer
Bill Moran wrote: > db.subscripti...@shepherdhill.biz wrote: >> Hi, >> >> I have a table with BIG SERIAL field as Primary KEY. During high load, >> entries in the BIG SERIAL field are jumped. One could see a row with >> 1367 and expecting the next INSERT to be 1368, one would end up >> getting 1369

Re: [GENERAL] Serial Jumping

2009-01-26 Thread Bill Moran
db.subscripti...@shepherdhill.biz wrote: > > Hi, > > I have a table with BIG SERIAL field as Primary KEY. During high load, > entries in the BIG SERIAL field are jumped. One could see a row with > 1367 and expecting the next INSERT to be 1368, one would end up > getting 1369. > > Please is this n

[GENERAL] Serial Jumping

2009-01-26 Thread db . subscriptions
Hi, I have a table with BIG SERIAL field as Primary KEY. During high load, entries in the BIG SERIAL field are jumped. One could see a row with 1367 and expecting the next INSERT to be 1368, one would end up getting 1369. Please is this normal? Regards, Chris -- Sent via pgsql-general mailing

Re: [GENERAL] serial

2008-12-05 Thread Grzegorz Jaśkiewicz
On Fri, Dec 5, 2008 at 8:24 AM, Thomas Kellerer <[EMAIL PROTECTED]> wrote: > Scott Marlowe, 04.12.2008 16:34: >> >> Like an Oracle DBA who told me >> pgsql was broken because the output of group by wasn't properly >> ordered like it was on Oracle 9. > > Then he did not know Oracle very well :) > Ev

Re: [GENERAL] serial

2008-12-05 Thread Thomas Kellerer
Scott Marlowe, 04.12.2008 16:34: Like an Oracle DBA who told me pgsql was broken because the output of group by wasn't properly ordered like it was on Oracle 9. Then he did not know Oracle very well :) Even Oracle 9 does not guarantee that the output of an GROUP BY is actually sorted, with

Re: [GENERAL] serial

2008-12-04 Thread Raymond O'Donnell
On 04/12/2008 14:47, Gregory Williamson wrote: > With respect, sir, let me point out that Informix usage says to insert a > zero to trigger a serial column, so don't be indicting Gustavo on MySQL So what do you do if you just want to insert a zero? - just curious... In fairness, I suppose you wo

Re: [GENERAL] serial

2008-12-04 Thread Scott Marlowe
On Thu, Dec 4, 2008 at 7:47 AM, Gregory Williamson <[EMAIL PROTECTED]> wrote: > The esteemed Scott Marlowe said: > >> >> On Thu, Dec 4, 2008 at 7:42 AM, Gustavo Rosso <[EMAIL PROTECTED]> >> wrote: >> > I created this table: >> > > <...> >> >> Because MySQL taught you bad habits? You told the db to

Re: [GENERAL] serial

2008-12-04 Thread Gregory Williamson
The esteemed Scott Marlowe said: > > On Thu, Dec 4, 2008 at 7:42 AM, Gustavo Rosso <[EMAIL PROTECTED]> wrote: > > I created this table: > > <...> > > Because MySQL taught you bad habits? You told the db to insert a 0, > so it inserted a 0. With respect, sir, let me point out that Informix us

Re: [GENERAL] serial

2008-12-04 Thread Scott Marlowe
On Thu, Dec 4, 2008 at 7:06 AM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Thu, Dec 4, 2008 at 7:42 AM, Gustavo Rosso <[EMAIL PROTECTED]> wrote: >> I created this table: >> >> create table se (n serial); >> >> Column | Type | Modifiers >> -+-+

Re: [GENERAL] serial

2008-12-04 Thread Scott Marlowe
On Thu, Dec 4, 2008 at 7:42 AM, Gustavo Rosso <[EMAIL PROTECTED]> wrote: > I created this table: > > create table se (n serial); > > Column | Type | Modifiers > -+-+ > n | integer| not null defaul

Re: [GENERAL] serial

2008-12-04 Thread Pavel Stehule
2008/12/4 Gustavo Rosso <[EMAIL PROTECTED]>: > I created this table: > > create table se (n serial); > > Column | Type | Modifiers > -+-+ > n | integer| not null default nextval('se_n_seq'::regcla

Re: [GENERAL] serial

2008-12-04 Thread Serge Fonville
On Thu, Dec 4, 2008 at 3:42 PM, Gustavo Rosso <[EMAIL PROTECTED]> wrote: > I created this table: > > create table se (n serial); > > Column | Type | Modifiers > -+-+ > n | integer| not null defau

Re: [GENERAL] serial

2008-12-04 Thread Grzegorz Jaśkiewicz
On Thu, Dec 4, 2008 at 2:42 PM, Gustavo Rosso <[EMAIL PROTECTED]> wrote: > I created this table: > > create table se (n serial); > in case you did just insert into se(n) values(0); twice, it won't work if you want to add series of numbers, don't define it as serial. Serial is for a different purpo

[GENERAL] serial

2008-12-04 Thread Gustavo Rosso
I created this table: create table se (n serial); Column | Type | Modifiers -+-+ n | integer| not null default nextval('se_n_seq'::regclass) I inserted two record, later select, but column n (

Re: [GENERAL] Serial/sequence problem

2008-11-25 Thread Sam Mason
On Tue, Nov 25, 2008 at 05:39:49PM +0930, Michael Hall wrote: > On Tue, Nov 25, 2008 at 08:26:55AM +0100, A. Kretschmer wrote: > > Set the sequence to the new value, 3636+9, via > > setval('your_sequence', 3636+9) > > I'll re-import the data with DEFAULT in the id (SERIAL) column, > hopefully new

Re: [GENERAL] Serial/sequence problem

2008-11-25 Thread Michael Hall
> The 3636 INSERT-Statements contains a fix value for the ID-Column, > right? Thats wrong, omit the id-column and value or use simply 'default' for > it. That's right. I thought that might be the case. > > - how can I rectify the situation? > Set the sequence to the new value, 3636+9, via > s

Re: [GENERAL] Serial/sequence problem

2008-11-24 Thread A. Kretschmer
am Tue, dem 25.11.2008, um 16:41:43 +0930 mailte Mike Hall folgendes: > I have just imported 3636 rows into a PG database table (PG 8.1 on CentOS 5.2 > ... the default). > The rows were imported using separate INSERT statements for each row. All OK > so far. > > After having had a few attempts

[GENERAL] Serial/sequence problem

2008-11-24 Thread Mike Hall
I have just imported 3636 rows into a PG database table (PG 8.1 on CentOS 5.2 ... the default). The rows were imported using separate INSERT statements for each row. All OK so far. After having had a few attempts at inserting new test rows (which all inserted OK), I notice that the last_value c

Re: [GENERAL] Serial - last value

2008-11-20 Thread Richard Huxton
hendra kusuma wrote: > > Let me get this clear > it should looks like this? > > create function something() returns integer as $$ > declare > ret integer; > begin > -- just assume something table has a serial column as primary key > insert into something values ('a value'); > select currv

Re: [GENERAL] Serial - last value

2008-11-20 Thread Richard Huxton
hendra kusuma wrote: > Hi there > a little basic question here > > I usually use something like this in stored function > to get the last value of a serial type column > > select last_value into ret from id_sequence >> return ret > > What i'm asking is, > if many people run the same stored funct

[GENERAL] Serial - last value

2008-11-20 Thread hendra kusuma
Hi there a little basic question here I usually use something like this in stored function to get the last value of a serial type column select last_value into ret from id_sequence > return ret > What i'm asking is, if many people run the same stored function at the same time will they get the

Re: [GENERAL] serial data type usage

2008-11-06 Thread Berend Tober
EXT-Rothermel, Peter M wrote: I have a table where I would like the primary key to be generated during the insert. Here is a simplified example: CREATE TABLE employee_type { tname varchar(10) PRIMARY KEY, id_prefix char(1) ; ... } tname | id_prefix --+--

Re: [GENERAL] serial data type usage

2008-11-06 Thread Alan Hodgson
On Thursday 06 November 2008, "EXT-Rothermel, Peter M" <[EMAIL PROTECTED]> wrote: > I have thought about using the serial data type for the employee.id but > I also want to automate the prepending of the { W, M, E } prefix. > You'll need write a before-insert trigger to assign the ID. -- Alan

[GENERAL] serial data type usage

2008-11-06 Thread EXT-Rothermel, Peter M
I have a table where I would like the primary key to be generated during the insert. Here is a simplified example: CREATE TABLE employee_type { tname varchar(10) PRIMARY KEY, id_prefix char(1) ; ... } tname | id_prefix --+-- worker | W manager | M exec

Re: [GENERAL] SERIAL datatype

2008-08-26 Thread Zoltan Boszormenyi
Mark Roberts írta: > On Mon, 2008-08-25 at 11:02 -0600, Scott Marlowe wrote: > >> Well, of course a 64 bit int is gonna be bigger than a 32 bit, but >> with alignment issues and on 64 bit hardware, I'm guessing the >> difference isn't exactly twice as slow / twice as much storage. And >> it's w

Re: [GENERAL] SERIAL datatype

2008-08-25 Thread Mark Roberts
On Mon, 2008-08-25 at 11:02 -0600, Scott Marlowe wrote: > Well, of course a 64 bit int is gonna be bigger than a 32 bit, but > with alignment issues and on 64 bit hardware, I'm guessing the > difference isn't exactly twice as slow / twice as much storage. And > it's way faster than a GUID which w

Re: [GENERAL] SERIAL datatype

2008-08-25 Thread Scott Marlowe
On Mon, Aug 25, 2008 at 10:23 AM, Mark Roberts <[EMAIL PROTECTED]> wrote: > > On Thu, 2008-08-21 at 13:53 -0600, Scott Marlowe wrote: >> Regular SERIAL type is limited to a 32 bit int. BIGSERIAL uses a 64 >> bit int. > > I think one of the things that would be offsetting is the size > difference b

Re: [GENERAL] SERIAL datatype

2008-08-25 Thread Mark Roberts
On Thu, 2008-08-21 at 13:53 -0600, Scott Marlowe wrote: > Regular SERIAL type is limited to a 32 bit int. BIGSERIAL uses a 64 > bit int. I think one of the things that would be offsetting is the size difference between the two types (32 vs 64 bits, 5 foreign keys, and a billion rows or so makes

Re: [GENERAL] SERIAL datatype

2008-08-24 Thread Alban Hertroys
On Aug 21, 2008, at 9:51 PM, Peter Billen wrote: My concern is not that the table will become full, but that the sequence will be exhausted. Doing INSERT, DELETE, INSERT, DELETE ... will exhaust the sequence. What will happen then? Do I have to manually re-order my serial values and reset t

Re: [GENERAL] SERIAL datatype

2008-08-22 Thread Sam Mason
On Thu, Aug 21, 2008 at 09:08:24PM +0200, Peter Billen wrote: > Is it possible to insert a new entry? Will the serial sequence somehow > be able to find the gap (3)? As others have said, no it's not going to. Sequences will only return values out of order when explicitly told to. The main reaso

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread Peter Billen
Thanks. I thought it was a bit counter-intuitive to have a BIGSERIAL while I will only have a few thousands of entries, which are updated (by DELETE and INSERT) constantly. Thanks Scott, Peter Scott Marlowe schreef: On Thu, Aug 21, 2008 at 1:08 PM, Peter Billen <[EMAIL PROTECTED]> wrote:

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread Scott Marlowe
On Thu, Aug 21, 2008 at 1:51 PM, Peter Billen <[EMAIL PROTECTED]> wrote: > My concern is not that the table will become full, but that the sequence > will be exhausted. Doing INSERT, DELETE, INSERT, DELETE ... will exhaust the > sequence. What will happen then? Do I have to manually re-order my ser

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread Scott Marlowe
On Thu, Aug 21, 2008 at 1:08 PM, Peter Billen <[EMAIL PROTECTED]> wrote: > Hi all, > > I would like to ask a question about the serial datatype. Say I have a field > of type serial, and say for the sake of example that the range of a serial > goes from 1 to 5 (inclusive). I insert 5 (ed) entries in

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread Peter Billen
My concern is not that the table will become full, but that the sequence will be exhausted. Doing INSERT, DELETE, INSERT, DELETE ... will exhaust the sequence. What will happen then? Do I have to manually re-order my serial values and reset the start sequence ID to MAX() + 1? Thanks in advance

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread ries van Twisk
On Aug 21, 2008, at 2:23 PM, Peter Billen wrote: Oops, my example was a bit incorrectly edited. I wanted to say that the range of a serial datatype goes from 1 to 5 (incluse) and I insert five entries (not 10). Peter Peter Billen schreef: Hi all, I would like to ask a question about the

Re: [GENERAL] SERIAL datatype

2008-08-21 Thread Peter Billen
Oops, my example was a bit incorrectly edited. I wanted to say that the range of a serial datatype goes from 1 to 5 (incluse) and I insert five entries (not 10). Peter Peter Billen schreef: Hi all, I would like to ask a question about the serial datatype. Say I have a field of type serial,

[GENERAL] SERIAL datatype

2008-08-21 Thread Peter Billen
Hi all, I would like to ask a question about the serial datatype. Say I have a field of type serial, and say for the sake of example that the range of a serial goes from 1 to 5 (inclusive). I insert 10 entries into the table, so the table is 'full': INSERT INTO my_table (my_serial) VALUES (D

Re: [GENERAL] Serial Data Type

2008-04-02 Thread Tom Lane
"Adam Rich" <[EMAIL PROTECTED]> writes: >> I have just created a table using SELECT INTO however the PK was >> supposed to be a serial. It is now an integer. To make it a serial I >> just create the seq and set the default to be the nextval() of that >> sequence right? is there anything else I need

Re: [GENERAL] Serial Data Type

2008-04-02 Thread Merlin Moncure
On Wed, Apr 2, 2008 at 10:12 PM, Naz Gassiep <[EMAIL PROTECTED]> wrote: > I have just created a table using SELECT INTO however the PK was > supposed to be a serial. It is now an integer. To make it a serial I > just create the seq and set the default to be the nextval() of that > sequence right

Re: [GENERAL] Serial Data Type

2008-04-02 Thread Adam Rich
> I have just created a table using SELECT INTO however the PK was > supposed to be a serial. It is now an integer. To make it a serial I > just create the seq and set the default to be the nextval() of that > sequence right? is there anything else I need to do? You'll want to do this: ALTER SE

[GENERAL] Serial Data Type

2008-04-02 Thread Naz Gassiep
I have just created a table using SELECT INTO however the PK was supposed to be a serial. It is now an integer. To make it a serial I just create the seq and set the default to be the nextval() of that sequence right? is there anything else I need to do? It'll maintain the transactional safety

Re: [GENERAL] SERIAL and Primary Key

2008-02-29 Thread Scott Marlowe
On Fri, Feb 29, 2008 at 2:28 PM, Mike Gould <[EMAIL PROTECTED]> wrote: > > > CREATE TABLE "fav5"."batchnumber" ( > "batchnumberid" SERIAL NOT NULL, > "processtype" SMALLINT NOT NULL, > "termloc" CHAR(3) NOT NULL, > "batchno" INTEGER NOT NULL > ) WITHOUT OIDS; > > With the above table defini

Re: [GENERAL] SERIAL and Primary Key

2008-02-29 Thread hubert depesz lubaczewski
On Fri, Feb 29, 2008 at 03:28:11PM -0500, Mike Gould wrote: > CREATE TABLE "fav5"."batchnumber" ( > "batchnumberid" SERIAL NOT NULL, > "processtype" SMALLINT NOT NULL, > "termloc" CHAR(3) NOT NULL, > "batchno" INTEGER NOT NULL > ) WITHOUT OIDS; > With the above table definition, is bat

Re: [GENERAL] SERIAL and Primary Key

2008-02-29 Thread Erik Jones
On Feb 29, 2008, at 2:28 PM, Mike Gould wrote: CREATE TABLE "fav5"."batchnumber" ( "batchnumberid" SERIAL NOT NULL, "processtype" SMALLINT NOT NULL, "termloc" CHAR(3) NOT NULL, "batchno" INTEGER NOT NULL ) WITHOUT OIDS; With the above table definition, is batchnumberid by default also

[GENERAL] SERIAL and Primary Key

2008-02-29 Thread Mike Gould
CREATE TABLE "fav5"."batchnumber" ( "batchnumberid" SERIAL NOT NULL, "processtype" SMALLINT NOT NULL, "termloc" CHAR(3) NOT NULL, "batchno" INTEGER NOT NULL ) WITHOUT OIDS; With the above table definition, is batchnumberid by default also defined as the primary key or do I still need

Re: [GENERAL] Serial IDs

2007-11-14 Thread Scott Marlowe
On Nov 14, 2007 5:17 PM, Bob Pawley <[EMAIL PROTECTED]> wrote: > Hi > > Is there any method of clearing the serial numbering so that ID references > can start afresh without rebuilding the database. > > Of I use postgresql as part of my application I would like to use pgdump to > ensure that I hav

[GENERAL] Serial IDs

2007-11-14 Thread Bob Pawley
Hi Is there any method of clearing the serial numbering so that ID references can start afresh without rebuilding the database. Of I use postgresql as part of my application I would like to use pgdump to ensure that I have the latest version and starting the serial numbering at #1 would be

Re: [GENERAL] serial grows on failed requests

2007-08-17 Thread Andreas Kretschmer
rihad <[EMAIL PROTECTED]> schrieb: > When I do an insert that fails (like FK inconsistency, illegal value, etc.) > the users.id grows nonetheless... This is unacceptable for my current normal behavior. > needs. Any way to prevent that while still maintaining ease of use? Using > PostgreSQL 8.

[GENERAL] serial grows on failed requests

2007-08-17 Thread rihad
Hi, my table is defined as: CREATE TABLE users ( id integer NOT NULL, ... ); CREATE SEQUENCE users_id_seq INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; ALTER SEQUENCE users_id_seq OWNED BY users.id; Although it's just a more verbose way to say create table users (id serial

Re: [GENERAL] serial column

2006-09-27 Thread Brandon Aiken
Title: RE: [GENERAL] serial column Yes, but if I tear down the house at 245 Main St, we don't renumber 247 Main St and on down the line, do we? The problem here is that even if you get the sequencing to work, your table is dangerously unstable.  If you have 700 rows and you delete row

Re: [GENERAL] serial column

2006-09-26 Thread Brandon Aiken
mailto:[EMAIL PROTECTED] Sent: Monday, September 25, 2006 12:00 PM To: Brandon Aiken; pgsql-general@postgresql.org Subject: Re: [GENERAL] serial column Actually, I am not trying to "force keys" nor, I don't beleive, am I trying to force an hierarchal structure within the database.

Re: [GENERAL] serial column

2006-09-25 Thread Jeff Davis
On Mon, 2006-09-25 at 00:19 +0200, Gevik Babakhani wrote: > On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: > > It's the behavior I expect - but the gaps aren't acceptable. > > > > Bob > > Then using the SERIAL or SEQUENCE won't do you any good. > > A possible solution for this would be to

Re: [GENERAL] serial column

2006-09-25 Thread Bob Pawley
e lowest serial ID number. ) Thanks for your comments - everything helps at my stage. Bob Pawley - Original Message - From: "Brandon Aiken" <[EMAIL PROTECTED]> To: Sent: Monday, September 25, 2006 7:47 AM Subject: Re: [GENERAL] serial column I would tend to

Re: [GENERAL] serial column

2006-09-25 Thread Brandon Aiken
do relationships it doesn't know about, so you technically violate first normal form by having a multi-valued field (it identifies uniqueness and order). -- Brandon Aiken CS/IT Systems Engineer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of To

Re: [GENERAL] serial column

2006-09-24 Thread Adrian Klaver
a gap. > > Perhaps a manually built table is the answer?? > > Bob > > > - Original Message - > From: "Tom Lane" <[EMAIL PROTECTED]> > To: "Bob Pawley" <[EMAIL PROTECTED]> > Cc: "Ragnar" <[EMAIL PROTECTED]>; "

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
uot; Sent: Sunday, September 24, 2006 4:30 PM Subject: Re: [GENERAL] serial column Bob Pawley <[EMAIL PROTECTED]> writes: I am using the numbers to identify devices. If a device is deleted or replaced with another type of device I want the numbering to still be sequential. It sounds to me l

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
D]> To: Cc: "Bob Pawley" <[EMAIL PROTECTED]> Sent: Sunday, September 24, 2006 6:11 PM Subject: Re: [GENERAL] serial column On Sunday 24 September 2006 02:29 pm, Bob Pawley wrote: Choice a. I am using the numbers to identify devices. If a device is deleted or replaced with anothe

Re: [GENERAL] serial column

2006-09-24 Thread Adrian Klaver
On Sunday 24 September 2006 02:29 pm, Bob Pawley wrote: > Choice a. > > I am using the numbers to identify devices. > > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. > > Bob > Do you have some other way of tracking a device? I am just

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
Thanks I'll give that a try. Bob - Original Message - From: "Gevik Babakhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 4:13 PM Subject: Re: [GENERAL] serial column On S

Re: [GENERAL] serial column

2006-09-24 Thread Tom Lane
Bob Pawley <[EMAIL PROTECTED]> writes: > I am using the numbers to identify devices. > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. It sounds to me like you oughtn't be storing these numbers in the database at all. You just want to

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 15:29 -0700, Bob Pawley wrote: > "A possible solution for this would be to regenerate the entire column's > values every time a record gets deleted starting form 1. but then again > this would be very slow if you have a very large table" > > I don't anticipate the table to be

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
ly fewer than 1,000. Could you point to some documentation for regenerating a column's values other than manual?? Bob - Original Message - From: "Gevik Babakhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql&qu

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
Do you have a for instance?? Bob - Original Message - From: "Ragnar" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 3:10 PM Subject: Re: [GENERAL] serial column On sun, 2006-09-24

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: > It's the behavior I expect - but the gaps aren't acceptable. > > Bob Then using the SERIAL or SEQUENCE won't do you any good. A possible solution for this would be to regenerate the entire column's values every time a record gets deleted sta

Re: [GENERAL] serial column

2006-09-24 Thread Ragnar
On sun, 2006-09-24 at 14:29 -0700, Bob Pawley wrote: > Choice a. > > I am using the numbers to identify devices. > > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. have you tried to implement ths using triggers? gnari --

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
It's the behavior I expect - but the gaps aren't acceptable. Bob - Original Message - From: "Gevik Babakhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:42 PM S

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
esolve. > > Bob > > - Original Message - > From: "Gevik Babakhani" <[EMAIL PROTECTED]> > To: "Bob Pawley" <[EMAIL PROTECTED]> > Cc: "Postgresql" > Sent: Sunday, September 24, 2006 2:00 PM > Subject: Re: [GENERAL] ser

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
CTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:24 PM Subject: Re: [GENERAL] serial column On sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: I need to develop a serial column that always starts at 1 and is sequential even after deletes. what exactly do you mean?

Re: [GENERAL] serial column

2006-09-24 Thread Ragnar
On sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: > I need to develop a serial column that always starts at 1 and is > sequential even after deletes. what exactly do you mean? say you have rows where your columns has values 1,2,3 and 4. you now delete the row where the value is 2. what do yo

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
akhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:00 PM Subject: Re: [GENERAL] serial column On Sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: I need to develop a serial column that always sta

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: > I need to develop a serial column that always starts at 1 and is > sequential even after deletes. > > Any ideas??? > Did you try the: create table tbl ( id SERIAL ); or even with primary key... create table tbl ( id SERI

[GENERAL] serial column

2006-09-24 Thread Bob Pawley
I need to develop a serial column that always starts at 1 and is sequential even after deletes.   Any ideas???   Bob    

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-13 Thread rloefgren
Thanks for all the help, it works and I've learned some more about COPY, which is treated thinly in Douglas's first edition of "PostgreSQL" (which was my source.) r ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread Michael Fuhr
On Tue, Sep 12, 2006 at 02:48:30PM -0400, Brandon Aiken wrote: > Serial fields have a default value of nextval, so if you add an 18th > field to your text file with DEFAULT in every record it should work as > intended. DEFAULT works with INSERT but not with COPY: test=> CREATE TABLE foo (col1 int

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread Scott Marlowe
On Tue, 2006-09-12 at 13:48, Brandon Aiken wrote: > Serial fields have a default value of nextval, so if you add an 18th > field to your text file with DEFAULT in every record it should work as > intended. Or you can use the copy table (field1,field2,field3,...field18) from stdin; syntax, and l

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread Alvaro Herrera
[EMAIL PROTECTED] wrote: > All, > > I have a pipe delimited text file I'm trying to copy to a table. The > file has 17 fields per line. The table has 18, with that last field > (record) a serial with sequence. I have done: > select setval('sequence_name_seq', 555, 'TRUE') > but when I do: COPY tab

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread Michael Fuhr
On Tue, Sep 12, 2006 at 09:27:55AM -0700, [EMAIL PROTECTED] wrote: > I have a pipe delimited text file I'm trying to copy to a table. The > file has 17 fields per line. The table has 18, with that last field > (record) a serial with sequence. I have done: > select setval('sequence_name_seq', 555, '

Re: [GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread Brandon Aiken
] Sent: Tuesday, September 12, 2006 12:28 PM To: pgsql-general@postgresql.org Subject: [GENERAL] serial, sequence, and COPY FROM All, I have a pipe delimited text file I'm trying to copy to a table. The file has 17 fields per line. The table has 18, with that last field (record) a serial

[GENERAL] serial, sequence, and COPY FROM

2006-09-12 Thread rloefgren
All, I have a pipe delimited text file I'm trying to copy to a table. The file has 17 fields per line. The table has 18, with that last field (record) a serial with sequence. I have done: select setval('sequence_name_seq', 555, 'TRUE') but when I do: COPY tablename FROM '/path/to/file/file.txt' de

Re: [GENERAL] Serial Updating

2006-09-03 Thread A. Kretschmer
am Sun, dem 03.09.2006, um 14:24:41 -0700 mailte Bob Pawley folgendes: > I have a column that I wish to use to designate loop numbers. > > A loop number is composed of a letter (F for flow, T for temperatures etc.) > followed by a sequence number starting at one and ending with the last loop. >

Re: [GENERAL] Serial Updating

2006-09-03 Thread Adrian Klaver
On Sunday 03 September 2006 02:24 pm, Bob Pawley wrote: > I have a column that I wish to use to designate loop numbers. > > A loop number is composed of a letter (F for flow, T for temperatures etc.) > followed by a sequence number starting at one and ending with the last > loop. > > The loop numbe

[GENERAL] Serial Updating

2006-09-03 Thread Bob Pawley
I have a column that I wish to use to designate loop numbers.   A loop number is composed of a letter (F for flow, T for temperatures etc.) followed by a sequence number starting at one and ending with the last loop.   The loop numbers will appear as F-1, T-2 and so on.   I seem to have no p

Re: [GENERAL] serial number in output

2005-10-28 Thread hubert depesz lubaczewski
On 10/28/05, alessandra de gregorio <[EMAIL PROTECTED]> wrote: What function should I use to get a serial number, together with my results,from a query?Ex. Of output I want:1   ooo pp  ij2   hou joo iu3   bhi ft  yhBasically, I would like to have one column with

[GENERAL] serial number in output

2005-10-28 Thread alessandra de gregorio
Hi, What function should I use to get a serial number, together with my results, from a query? Ex. Of output I want: 1 ooo pp ij 2 hou joo iu 3 bhi ft yh Basically, I would like to have one column with integers, from 1 onwards, no matter how man

  1   2   >