KEYEXISTS function

From: April L <april(at)i-netco(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: KEYEXISTS function
Date: 2002-07-04 14:46:20
Message-ID: 3.0.5.32.20020704104620.02d0f008@mail.i-netco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

In an old DOS database program I programmed in for years, there was a handy
function called

KEYEXISTS("value",index)

value of course was only in quotes if it was a string.

I'm imagining this could be pretty easily created as a function for
postgres, and I'm wondering if someone has already done this?

The recent discussion here on the Novice list sparked my memory of how very
often a KEYEXISTS type of function is useful. I know in my own work, an
attempt to insert a record where the primary key would be duplicated,
results in an error to the user, so I have to error trap and cannot "try to
insert and do something else if insert doesn't work" - I have to look for
the existence of a conflicting record and not insert if there is one.

Thank you,

- April

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message caroline kenny 2002-07-04 15:26:48 Carraige Return issue
Previous Message Manfred Koizar 2002-07-04 13:18:12 Re: best match question: please help