On Wed, 24 May 2006 10:12:17 -0400, Andrew wrote:
> Patches should be made against the HEAD branch in CVS, not against a
> distro source.
Ok; I'll do that. (The patch did apply cleanly to CVS, though, but
anyway).
On Wed, 24 May 2006 15:41:07 -0400, Tom wrote:
> Andrew Dunstan <[EMAIL PROTECTED]> writes:
>> This seems like a good idea, but we should probably make analogous
>> changes for plpgsql, pltcl and plpython. Having different trigger data
>> available in some of these doesn't seem like a good idea.
> Yeah. I'm also a little disturbed by using "nspname" which is an
> entirely internal name; plus it's a bit unclear *which* schema it's
> supposed to be. (One might think it's the schema the trigger function
> is in, for instance.) Somebody established a bad precedent by using
> "relname" for the table name.
I wasn't sure what to call it, so I modelled my change after relname ~
SPI_getrelname and arrived at the questionable nspname ~ SPI_getnspname.
> Maybe we should use field names like "table_name" and "table_schema".
> "relname" could be kept around for awhile but deprecated as a duplicate
> of "table_name".
On Thu, 25 May 2006 16:06:12 -0000, Greg wrote:
> +1 for table_schema and table_name, especially if in the future we provide
> things like trigger_schema.
I've attached a new patch, against CVS, that adds table_name and
table_schema instead, and updates the doc accordingly.
I haven't looked at the other languages as I do not use them; let me
know if I should take a stab at providing patches for them as well.
Thanks for your comments.
Best regards,
Adam
--
"Our hero regains consciousness at the feet of a Adam Sjøgren
sarcastic alien..." [EMAIL PROTECTED]
? patch
Index: doc/src/sgml/plperl.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/plperl.sgml,v
retrieving revision 2.52
diff -c -r2.52 plperl.sgml
*** doc/src/sgml/plperl.sgml 10 Mar 2006 19:10:48 -0000 2.52
--- doc/src/sgml/plperl.sgml 25 May 2006 18:49:34 -0000
***************
*** 728,734 ****
</varlistentry>
<varlistentry>
! <term><literal>$_TD->{relname}</literal></term>
<listitem>
<para>
Name of the table on which the trigger fired
--- 728,734 ----
</varlistentry>
<varlistentry>
! <term><literal>$_TD->{table_name}</literal></term>
<listitem>
<para>
Name of the table on which the trigger fired
***************
*** 737,742 ****
--- 737,760 ----
</varlistentry>
<varlistentry>
+ <term><literal>$_TD->{relname}</literal></term>
+ <listitem>
+ <para>
+ Name of the table on which the trigger fired. This has been deprecated. Please use $_TD->{table_name} instead.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>$_TD->{table_schema}</literal></term>
+ <listitem>
+ <para>
+ Name of the schema in which the table on which the trigger fired, is
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><literal>$_TD->{argc}</literal></term>
<listitem>
<para>
Index: src/pl/plperl/plperl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plperl/plperl.c,v
retrieving revision 1.108
diff -c -r1.108 plperl.c
*** src/pl/plperl/plperl.c 4 Apr 2006 19:35:37 -0000 1.108
--- src/pl/plperl/plperl.c 25 May 2006 18:49:37 -0000
***************
*** 525,530 ****
--- 525,536 ----
hv_store(hv, "relname", 7,
newSVpv(SPI_getrelname(tdata->tg_relation), 0), 0);
+ hv_store(hv, "table_name", 10,
+ newSVpv(SPI_getrelname(tdata->tg_relation), 0), 0);
+
+ hv_store(hv, "table_schema", 12,
+ newSVpv(SPI_getnspname(tdata->tg_relation), 0), 0);
+
if (TRIGGER_FIRED_BEFORE(tdata->tg_event))
when = "BEFORE";
else if (TRIGGER_FIRED_AFTER(tdata->tg_event))
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match