Auomatic numbering, replacing nulls and IF

From: "Pestilence" <me(at)work(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Auomatic numbering, replacing nulls and IF
Date: 2002-03-14 20:52:46
Message-ID: 3c910d7d$1@news.nz.asiaonline.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm a child of Oracle and MS-SQL (forgive me) and have only been playing
with Postgres for a few days. I have 3 questions that I couldn't find
answers for in the online docs:

1) Is it possible to create an INT PRIMARY KEY column that automagically
numbers itself? MS-SQL does this using the IDENTITY keyword.

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?

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

================================
Luke Pascoe
Senior Developer
IT Support & Development Limited
http://wwwitsd.co.nz
Mobile: (021) 303019
Email: luke(at)itsd(dot)co(dot)nz
================================

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pestilence 2002-03-14 20:58:22 Re: Auomatic numbering, replacing nulls and IF
Previous Message Ron Snyder 2002-03-14 20:45:28 Re: Unexplainable slow down...