Thread: what datatype is for autonumbering.in postgress

what datatype is for autonumbering.in postgress

From
"deepak pal"
Date:
hi
  i have to make ine field autonumber field what datatype should be used..??
plz reply meee..
On 4/3/06, William Leite Araújo <william.bh@gmail.com> wrote:
>       You can make a function to do this.
>
>   CREATE FUNCTION drop_operators(text) RETURNS BOOL AS
>   $$
>   DECLARE
>     op record;
>   BEGIN
>     FOR op IN SELECT opname
>                      FROM pg_operator as o left join pg_namespace as n on (
> o.oprnamespace = n.oid)
>                      WHERE nspname = $1
>     LOOP
>       EXECUTE 'DROP OPERATOR '||quote_literal(op.opname)||';';
>     END LOOP;
>     RETURN TRUE;
>   END;
>   $$ LANGUAGE 'plpgsql' IMMUTABLE;
>
>   And so: SELECT drop_operators('public');
>
> On 3/31/06, Martin Pohl <Nilpherd@gmx.net> wrote:
> >
> >
> > Hi,
> >
> > I have a database with operators and functions in plpgsql.
> > To update the data to the latest version I would like to drop all
> > operators.
> > There might be some, that I don't know. I don't have access to the
> > database,
> > but have to write a script, that will update the data.
> >
> > Is there any way to drop all operators (given they are all in the schema
> > "public) in a script?
> >
> > Something like (pseudocode):
> > Drop all operators in schema "public"
> >
> > Thanks in advance for answers
> >
> > --
> > E-Mails und Internet immer und überall!
> > 1&1 PocketWeb, perfekt mit GMX: http://www.gmx.net/de/go/pocketweb
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> >        subscribe-nomail command to majordomo@postgresql.org so that your
> >        message can get through to the mailing list cleanly
> >
>
>
>
> --
> William Leite Araújo
>
>

Re: what datatype is for autonumbering.in postgress

From
Chris
Date:
deepak pal wrote:
> hi
>   i have to make ine field autonumber field what datatype should be used..??

serial.

http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL

--
Postgresql & php tutorials
http://www.designmagick.com/

Re: what datatype is for autonumbering.in postgress

From
"A. Kretschmer"
Date:
am  04.04.2006, um 10:07:58 +0530 mailte deepak pal folgendes:
> hi
>   i have to make ine field autonumber field what datatype should be used..??
> plz reply meee..

You can use serial data types for this, read
http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL


> On 4/3/06, William Leite Araújo <william.bh@gmail.com> wrote:
> >       You can make a function to do this.

Please, no silly fullquote below your question.


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===