Re: Inserting a needed record before a select

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: "Jay O'Connor" <joconnor(at)cybermesa(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inserting a needed record before a select
Date: 2003-04-14 19:33:36
Message-ID: Pine.LNX.4.33.0304141332090.18268-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2003-04-14 19:46:24 Re: Batch replication ordering (was Re: [GENERAL] 32/64-bit
Previous Message Detlef Jockheck 2003-04-14 19:30:59 unsubscribe pgsql-general