noobie question - Mailing list pgsql-general

From Steve Clark
Subject noobie question
Date
Msg-id 51016586.8000709@netwolves.com
Whole thread Raw
Responses Re: noobie question  (Chris Angelico <rosuav@gmail.com>)
Re: noobie question  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Re: noobie question  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: noobie question  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: noobie question  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Re: noobie question  (Chris Angelico <rosuav@gmail.com>)
List pgsql-general
Hi list,

This may be really simple - I usually do it using a procedural language such as php or a bash script.

Say I have a table that has 2 columns like
create table "foo" (
   id integer not null,
   name text
);
CREATE UNIQUE INDEX "foo_pkey" on "foo" using btree ( "id" "int4_ops" );

with 10 rows of data where id is 1 to 10.

Now I want to insert a new row ahead of id 5 so I have to renumber the rows
from 5 to 10 increasing each by one.

Or the opposite I want to delete a row an renumber to close up the gap.

Is there an easy way to do this in postgresql without resulting to some external language?

Thanks for your consideration.



--
Stephen Clark



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Optimizing select count query which often takes over 10 seconds
Next
From: Chris Angelico
Date:
Subject: Re: noobie question