Skip site navigation (1) Skip section navigation (2)

Re: [COMMITTERS] pgsql-server: Clean up generation of default

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Subject: Re: [COMMITTERS] pgsql-server: Clean up generation of default
Date: 2004-06-11 21:48:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committerspgsql-hackers
On June 11, 2004 05:51 am, Christopher Kings-Lynne wrote:
> >>> 3. Or even create a pg_get_sequence() function:
> >>> SELECT SETVAL(pg_get_sequence(schema.table, col), 17);
> >>
> >> Actually, this is the best solution :)
> OK, attached is a pg_get_serial_sequence(schema, table, column) function
> .  I have tested it with crazy names and it seems to be good.  It works
> like this:
> SELECT setval(pg_get_serial_sequence('public', 'mytable', 'mycol'), 1,
> false);

I'd be inclined to make it only take 2 args, table, col  where table can be 
namespace qualified.  This allows people who arn't namespace aware to just do 
SELECT pg_get_serial_sequence('mytable','mycol') and have it return the 
correct item following searchpath..  I would think this would then become 
consistant with the standard behavior.  Not to mention it would also allow 
for easier moving schema form one namespace to another.. 

> If someone approves it, i'll work on making it a built-in backend
> function, and make pg_dump use it.
> This will also be great for our app, since we would no longer have to
> have hard-coded sequence names in our code.  (For getting last sequence
> val on oid-less tables)
> Chris

Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx:  250.763.1759

In response to


pgsql-hackers by date

Next:From: Andreas PflugDate: 2004-06-11 22:01:52
Subject: Re: Compiling libpq with VisualC
Previous:From: Scott MarloweDate: 2004-06-11 21:41:56
Subject: Re: [pgsql-hackers-win32] Tablespaces

pgsql-committers by date

Next:From: Bruce MomjianDate: 2004-06-12 03:55:18
Subject: pgsql-server: Update release notes for 7.4.3.
Previous:From: User TomDate: 2004-06-11 20:47:20
Subject: pqa - pqa: Continuing to make the xLogReader classes look the same

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group