Re: Auomatic numbering, replacing nulls and IF - Mailing list pgsql-general

From Jean-Michel POURE
Subject Re: Auomatic numbering, replacing nulls and IF
Date
Msg-id 200203201555.g2KFt292009534@www1.translationforge
Whole thread Raw
In response to Auomatic numbering, replacing nulls and IF  ("Pestilence" <me@work.com>)
List 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

pgsql-general by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: SQL Server performing much better?!?!
Next
From: Thomas Lockhart
Date:
Subject: Re: Al Dev and Postgresql book