Re: [SQL] updating a sequence

2011-11-16 Thread John Fabiani
On Tuesday, November 15, 2011 07:46:19 pm Scott Marlowe wrote: On Tue, Nov 15, 2011 at 5:33 PM, Samuel Gendler sgend...@ideasculptor.com wrote: On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani jo...@jfcomputer.com wrote: On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: On

Re: [SQL] updating a sequence

2011-11-16 Thread John Fabiani
On Tuesday, November 15, 2011 08:06:30 am John Fabiani wrote: Hi, I have need of a statement that updates the sequence but uses a max() to find the number. alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho). Postgres

Re: [SQL] updating a sequence

2011-11-16 Thread Jasen Betts
On 2011-11-16, Scott Marlowe scott.marl...@gmail.com wrote: You need to wrap a subselect in (): select setval('foo', (select max(some_id) from some_table)); I prefer to do it in once select like this: select setval('foo', max(some_id)) from some_table; -- ⚂⚃ 100% natural -- Sent via

[SQL] updating a sequence

2011-11-15 Thread John Fabiani
Hi, I have need of a statement that updates the sequence but uses a max() to find the number. alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho). Postgres 8.4 Thanks in advance, Johnf -- Sent via pgsql-sql mailing list

Re: [SQL] updating a sequence

2011-11-15 Thread Richard Broersma
On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani jo...@jfcomputer.com wrote: alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho). http://www.postgresql.org/docs/9.1/interactive/functions-sequence.html#FUNCTIONS-SEQUENCE-TABLE

Re: [SQL] updating a sequence

2011-11-15 Thread John Fabiani
On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani jo...@jfcomputer.com wrote: alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho).

Re: [SQL] updating a sequence

2011-11-15 Thread Samuel Gendler
On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani jo...@jfcomputer.com wrote: On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani jo...@jfcomputer.com wrote: alter sequence somename restart with (select max(pk) from sometable).

Re: [SQL] updating a sequence

2011-11-15 Thread Scott Marlowe
On Tue, Nov 15, 2011 at 5:33 PM, Samuel Gendler sgend...@ideasculptor.com wrote: On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani jo...@jfcomputer.com wrote: On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani jo...@jfcomputer.com

Re: [SQL] updating a sequence

2011-11-15 Thread Scott Marlowe
On Tue, Nov 15, 2011 at 8:46 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Nov 15, 2011 at 5:33 PM, Samuel Gendler sgend...@ideasculptor.com wrote: On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani jo...@jfcomputer.com wrote: On Tuesday, November 15, 2011 08:33:54 am Richard Broersma

Re: [SQL] updating a sequence

2011-11-15 Thread Sam Gendler
Sent from my iPhone On Nov 15, 2011, at 7:49 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Nov 15, 2011 at 8:46 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Nov 15, 2011 at 5:33 PM, Samuel Gendler sgend...@ideasculptor.com wrote: On Tue, Nov 15, 2011 at 4:28 PM,