On Sun, 2012-12-02 at 11:42 +, Jasen Betts wrote:
> On 2012-11-24, Peter Kroon wrote:
> > --f46d04389321c8f47d04cf3c0f32
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
> > 1;
>
> > The query fails:
> > ALTER
On 2012-11-24, Peter Kroon wrote:
> --f46d04389321c8f47d04cf3c0f32
> Content-Type: text/plain; charset=ISO-8859-1
>
> ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
> 1;
> The query fails:
> ALTER SEQUENCE (select pg_get_serial_sequence('table...
> it's because of the
Hello
you can't to do it directly. Expression cannot be used instead object name
you can use a plpgsql DO in this moment
DO $$
BEGIN
EXECUTE format('ALTER SEQUENCE %I RESTART WITH 1',
pg_get_serial_sequence('table', 'id'));
END;
$$ LANGUAGE plpgsql;
Regards
Pavel Stehule
2012/11/24 Peter Kr
ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH
1;
The query fails:
ALTER SEQUENCE (select pg_get_serial_sequence('table...
it's because of the (
I guess I'm using the wrong syntax.
It is possible this way? Would be great!
Best,
Peter
Scott Marlowe wrote:
On 9/18/07, Jeff Ross <[EMAIL PROTECTED]> wrote:
I'm using copy to insert a bunch of rows into a new table with a unique
primary key. Copy is correctly incrementing the primary key, but
apparently the sequence itself is never updated because when I go to
insert again I get
On 9/18/07, Jeff Ross <[EMAIL PROTECTED]> wrote:
> I'm using copy to insert a bunch of rows into a new table with a unique
> primary key. Copy is correctly incrementing the primary key, but
> apparently the sequence itself is never updated because when I go to
> insert again I get a constraint vio
I'm using copy to insert a bunch of rows into a new table with a unique
primary key. Copy is correctly incrementing the primary key, but
apparently the sequence itself is never updated because when I go to
insert again I get a constraint violation.
Here's the start of the new table creation:
CR
On Sat, May 20, 2006 at 11:46:25AM +0200, Tomi NA wrote:
> On 5/20/06, Martijn van Oosterhout wrote:
>
> >Seems you can't use a variable there. Your choices are to build a
> >string and use EXECUTE, or just do:
> >
> >SELECT setval('sequence',value);
>
> The EXECUTE string solution did the job.
On Thu, May 18, 2006 at 11:42:02PM -0700, Don Y wrote:
> We aren't populating tables. Most of our work is involved
> in the things *around* the database (the database is just a
> small piece of the puzzle). I, for example, drop all of
> my tables at the end of each work day -- along with most
> o
On Fri, May 19, 2006 at 02:08:01AM -0400, Tom Lane wrote:
> Don Y <[EMAIL PROTECTED]> writes:
> > Jim C. Nasby wrote:
> >> This is a very minor reason why you should be running the most recent
> >> 8.0.x release and not 8.0.3. A much bigger reason is that there are
> >> data-loss bugs that have bee
On 5/20/06, Martijn van Oosterhout wrote:
Seems you can't use a variable there. Your choices are to build a
string and use EXECUTE, or just do:
SELECT setval('sequence',value);
The EXECUTE string solution did the job. Thank you very much, Martijn.
t.n.a.
---(end of
On Sat, May 20, 2006 at 09:52:29AM +0200, Tomi NA wrote:
> I need to generate a couple of dozen statements reseting my sequences
> so that they're next values are greater than the biggest existing ids.
> The problem is, I can't even form a statement to update one sequence.
> This is what I tried:
I need to generate a couple of dozen statements reseting my sequences
so that they're next values are greater than the biggest existing ids.
The problem is, I can't even form a statement to update one sequence.
This is what I tried:
CREATE OR REPLACE FUNCTION init_sequences() RETURNS void AS
$BOD
Tom Lane wrote:
Don Y <[EMAIL PROTECTED]> writes:
Jim C. Nasby wrote:
This is a very minor reason why you should be running the most recent
8.0.x release and not 8.0.3. A much bigger reason is that there are
data-loss bugs that have been fixed.
The folks watching the Postgres releases haven'
Don Y <[EMAIL PROTECTED]> writes:
> Jim C. Nasby wrote:
>> This is a very minor reason why you should be running the most recent
>> 8.0.x release and not 8.0.3. A much bigger reason is that there are
>> data-loss bugs that have been fixed.
> The folks watching the Postgres releases haven't yet sai
Jim C. Nasby wrote:
On Wed, May 17, 2006 at 03:00:48PM -0700, Don Y wrote:
I see the documentation mention added August 1, 2005 byt Tom Lane.
Date tag on the bottom of my man pages is "2005-01-17" -- so that
explains *that*! :>
This is a very minor reason why you should be running the most r
On Wed, May 17, 2006 at 03:00:48PM -0700, Don Y wrote:
> >I see the documentation mention added August 1, 2005 byt Tom Lane.
>
> Date tag on the bottom of my man pages is "2005-01-17" -- so that
> explains *that*! :>
This is a very minor reason why you should be running the most recent
8.0.x rel
Don Y wrote:
> Bruce Momjian wrote:
> > Don Y wrote:
> >> Bruce Momjian wrote:
> >>> Don Y wrote:
> Hi,
>
> It doesn't appear that there is a way to rename a sequence
> (ideally with a "cascade" action).
> >>>
> >>> Uh, the ALTER SEQUENCE manual page says:
> >> Uh, the 8.0.3 man
Bruce Momjian wrote:
Don Y wrote:
Bruce Momjian wrote:
Don Y wrote:
Hi,
It doesn't appear that there is a way to rename a sequence
(ideally with a "cascade" action).
Uh, the ALTER SEQUENCE manual page says:
Uh, the 8.0.3 man page for ALTER SEQUENCE makes no mention of this.
Nor does "\h AL
Don Y wrote:
> Bruce Momjian wrote:
> > Don Y wrote:
> >> Hi,
> >>
> >> It doesn't appear that there is a way to rename a sequence
> >> (ideally with a "cascade" action).
> >
> >
> > Uh, the ALTER SEQUENCE manual page says:
>
> Uh, the 8.0.3 man page for ALTER SEQUENCE makes no mention of this.
Bruce Momjian wrote:
Don Y wrote:
Hi,
It doesn't appear that there is a way to rename a sequence
(ideally with a "cascade" action).
Uh, the ALTER SEQUENCE manual page says:
Uh, the 8.0.3 man page for ALTER SEQUENCE makes no mention of this.
Nor does "\h ALTER SEQUENCE" in psql yield any po
Don Y wrote:
> Hi,
>
> It doesn't appear that there is a way to rename a sequence
> (ideally with a "cascade" action).
Uh, the ALTER SEQUENCE manual page says:
Some variants of ALTER TABLE can be used with sequences as
well; for example, to rename a sequence use ALTER TABLE
Hi,
It doesn't appear that there is a way to rename a sequence
(ideally with a "cascade" action).
Nor does there appear to be a way to change the owner of
a sequence.
Obviously, I can DROP and recreate... *but*, how prudent
(foolish?) would it be just to change the entries in the
system tables
I am moving my database from a machine running 7.4 to a machine running 7.2. My
sequences are not out of wack, is there a way to set the current value of a
sequence? I though ALTER SEQUENCE would work but it does not exist in version 7.2.
Thanks,
~S
---(end of broadcast)
Shea Martin wrote:
I am moving my database from a machine running 7.4 to a machine running
7.2. My sequences are not out of wack, is there a way to set the
current value of a sequence? I though ALTER SEQUENCE would work but it
does not exist in version 7.2.
Thanks,
~S
I honestly did to google
25 matches
Mail list logo