Re: Inserting a needed record before a select - Mailing list pgsql-general

From scott.marlowe
Subject Re: Inserting a needed record before a select
Date
Msg-id Pine.LNX.4.33.0304141332090.18268-100000@css120.ihs.com
Whole thread Raw
In response to Re: Inserting a needed record before a select  ("Jay O'Connor" <joconnor@cybermesa.com>)
List pgsql-general
On Mon, 14 Apr 2003, Jay O'Connor wrote:

> At 12:27 PM 04/14/2003 -0600, scott.marlowe wrote:
>
> >Crap, sorry, you're right.  You'll need to use a rule.  Rules are simpler
> >than triggers / functions.  They're described in the programmer's guide,
> >section 13 for 7.3.2.
>
> Problem is RULEs don't seem to have the sophistication I need (boolean
> logic...search for a record and if it doesn't exists, insert it, then
> re-SELECT on the same table)

I think it might be doable anyway.  Since rules allow where clauses, maybe
you could make one that had a where clause to test to see if the row
existed and if not then it calls a function to create the row.

I'm busy wrestling an import script to the ground right now, but I'll try
to see if I can make something like that work when I get a minute.


pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Batch replication ordering (was Re: [GENERAL] 32/64-bit
Next
From: "Ed L."
Date:
Subject: Re: Batch replication ordering (was Re: [GENERAL] 32/64-bit