Re: Auomatic numbering, replacing nulls and IF

From: Jean-Michel POURE <jm(dot)poure(at)freesurf(dot)fr>
To: "Pestilence" <me(at)work(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Auomatic numbering, replacing nulls and IF
Date: 2002-03-20 15:55:02
Message-ID: 200203201555.g2KFt292009534@www1.translationforge
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le Jeudi 14 Mars 2002 21:52, Pestilence a écrit :
> 1) Is it possible to create an INT PRIMARY KEY column that automagically
> numbers itself? MS-SQL does this using the IDENTITY keyword.
Use serial type.

> 2) The ISNULL function in both Oracle and MS-SQL takes 2 numbers and
> returns the second if the first is null, otherwise it returns the first.
> ISNULL in Postgres seems to be something quite different. Before I go
> writing my own function to do it, is there one already?

See COALESCE and NULLIF at
http://www.postgresql.com/idocs/index.php?functions-conditional.html

> 3) How do I do 'IF this_sql THEN that_sql'? I keep getting:
> parse error at or near "IF"

CASE WHEN condition THEN result
[WHEN ....]
ELSE

Cheers,
Jean-Michel POURE

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Eckermann 2002-03-20 15:57:54 Re: How to create crude report with psql and/or plpgsql
Previous Message Peter Keller 2002-03-20 15:32:23 no quotes in arrays in 7.2