Re: [HACKERS] Updating column on row update

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "Thom Brown" <thombrown(at)gmail(dot)com>, "PGSQL Mailing List" <pgsql-general(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org>, "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>
Subject: Re: [HACKERS] Updating column on row update
Date: 2009-11-24 17:59:40
Message-ID: 4B0BCAAC020000250002CC40@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> The argument against CINE is that it's unsafe.

By no means rhetorically, is that based on the assumption that the
statement would not validate that the existing object (if any) matches
the supplied definition?

> The fragment proposed by Andrew is no safer, of course, but it could
> be made safe by adding additional checks that the properties of the
> existing object are what the script expects.

Again, not rhetorically, is that assuming an error-free mapping of the
CREATE statement to all the related system tables -- each time it is
written by every user, individually?

> So in principle that's an acceptable approach,
> whereas CINE will never be safe.

Only with the most simplistic implementation of CINE. I really don't
see how that assertion holds up if there is checking of the supplied
definition against the existing object. Even the most simplistic
definition is arguably safer than CREATE OR REPLACE, since that can
destroy existing data. An implementation which does the checking that
you suggest, reviewed by this community to confirm that it is correct,
would seem to beat out most people's home-grown attempts to write what
you suggest.

> But actually I thought we had more or less concluded that CREATE OR
> REPLACE LANGUAGE would be acceptable (perhaps only if it's given
> without any extra args?). Or for that matter there seems to be
> enough opinion on the side of just installing plpgsql by default.
> CINE is a markedly inferior alternative to either of those.

It sounded pretty much like a consensus on installing by default to
me; however, that doesn't seem like it has anything to do with
Andrew's example or my reply to it.

-Kevin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2009-11-24 18:20:44 Re: [HACKERS] Updating column on row update
Previous Message Harald Fuchs 2009-11-24 17:32:00 Re: pgsql 'prefix' error

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-11-24 18:02:31 Re: Syntax conflicts in frame clause
Previous Message Tom Lane 2009-11-24 17:28:20 Re: [HACKERS] Updating column on row update