Re: better way?



On 12 Aug., 09:14, Dennis Lee Bieber <wlfr...@xxxxxxxxxxxxx> wrote:
On Tue, 11 Aug 2009 11:45:50 -0700 (PDT), Pet <petshm...@xxxxxxxxxxxxxx>
declaimed the following in gmane.comp.python.general:

Oh, forgotten to mention. It's PostGres

        Really? There are still installations of an RDBMS that predates the
commonalization of SQL?

        I suspect you mean PostgreSQL -- it IS a different beast from the
older Postgres.

O, yeah. Of course it is PostgreSQL


        In either event -- my old books don't show an "all in one" solution.

        Best answer is probably to create some stored procedures which you
call instead of plain INSERT; the stored procedure could then do
whatever is needed to check for a duplicate (actually the easiest, I'd
think, would be: if primary key is supplied, it is an UPDATE; if primary
key is NULL or not supplied, it is an insert and the primary key will be
auto-generated).

I don't really like the idea of stored procedure, because query would
depend on existence of it then. On the other side, it looks like best
option.


--
        Wulfraed         Dennis Lee Bieber               KD6MOG
        wlfr...@xxxxxxxxxxxxx     HTTP://wlfraed.home.netcom.com/

.