KEYEXISTS function - Mailing list pgsql-novice

From April L
Subject KEYEXISTS function
Date
Msg-id 3.0.5.32.20020704104620.02d0f008@mail.i-netco.com
Whole thread Raw
Responses Re: KEYEXISTS function  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-novice by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: best match question: please help
Next
From: "caroline kenny"
Date:
Subject: Carraige Return issue