Re: patch: plpgsql - access records with rec.(expr) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: patch: plpgsql - access records with rec.(expr)
Date
Msg-id 15979.1101140392@sss.pgh.pa.us
Whole thread Raw
In response to Re: patch: plpgsql - access records with rec.(expr)  (Matt <matt@kynx.org>)
Responses Re: patch: plpgsql - access records with rec.(expr)  (Matt <matt@kynx.org>)
List pgsql-hackers
Matt <matt@kynx.org> writes:
> Does that make any sense? Is it worth the work? Or should we just tell
> anyone who actually needs it (I don't, at present) 'use another PL'?

I don't really see this going anywhere --- it's contorting the semantics
of plpgsql too much for too little gain.  The typical use-case I've
heard of for this sort of thing is "I want to write a generic trigger,
so I need to iterate over the columns of NEW.* without knowing their
names or data types in advance".  Your proposal doesn't address the
issue of how the function would find out the column names in order to
make use of the proposed notation; and as you noted there's still a
serious problem with varying datatypes.

Either plperl or pltcl (probably also plpython but I'm not familiar
with that language) is a better choice for writing such triggers,
because those languages already have answers for all these issues.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch: plpgsql - access records with rec.(expr)
Next
From: Andreas Pflug
Date:
Subject: Re: Test database for new installs?