From:
Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To:
Robert Haas <robertmhaas(at)gmail(dot)com>
Cc:
Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Greg Smith <greg(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject:
Re: Command Triggers
Date:
2012-01-20 17:14:47
Message-ID:
m2ty3q9tyw.fsf@2ndQuadrant.fr (view raw or flat )
Thread:
2011-11-08 17:47:13 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-11-26 19:20:58 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-01 21:02:18 from Simon Riggs <simon(at)2ndQuadrant(dot)com>
2011-12-03 13:23:48 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-01 16:32:10 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-02 23:04:57 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-03 18:17:14 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-05 21:15:20 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-01 18:12:18 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-01 18:21:25 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-01 19:18:41 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-01 20:57:40 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-02 02:09:55 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-03 21:57:49 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-04 01:09:08 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-04 16:34:44 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-04 19:01:34 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-11 03:26:01 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-11 19:09:36 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2011-12-11 22:46:07 from Andres Freund <andres(at)anarazel(dot)de>
2012-02-27 23:26:05 from Andres Freund <andres(at)anarazel(dot)de>
2012-02-27 23:30:36 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-02-27 23:43:02 from Andres Freund <andres(at)anarazel(dot)de>
2012-03-20 16:02:01 from Andres Freund <andres(at)anarazel(dot)de>
2012-03-21 15:54:00 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-03-21 15:58:22 from Andres Freund <andres(at)anarazel(dot)de>
2012-03-21 16:40:57 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-27 23:44:18 from Andres Freund <andres(at)anarazel(dot)de>
2012-02-27 23:54:41 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-02-28 02:12:08 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2011-12-02 21:01:47 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-11 18:55:39 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-12 16:32:45 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-12 16:45:54 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2011-12-12 17:12:25 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-12 16:49:59 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-12 19:19:45 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-12 20:28:53 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-13 13:25:03 from Greg Smith <greg(at)2ndQuadrant(dot)com>
2011-12-13 14:59:48 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-13 15:53:24 from Merlin Moncure <mmoncure(at)gmail(dot)com>
2011-12-13 15:57:11 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-13 17:29:04 from Christopher Browne <cbbrowne(at)gmail(dot)com>
2011-12-13 17:35:46 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-14 10:41:58 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-13 17:58:05 from Greg Smith <greg(at)2ndQuadrant(dot)com>
2011-12-14 02:12:56 from Jan Wieck <JanWieck(at)Yahoo(dot)com>
2011-12-14 10:58:28 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-14 10:22:21 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-14 14:05:24 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2011-12-14 21:22:47 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-14 22:44:32 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-15 14:36:25 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-15 14:50:55 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-15 15:53:15 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-15 16:15:24 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-15 16:46:05 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-15 19:29:49 from Noah Misch <noah(at)leadboat(dot)com>
2011-12-15 20:04:39 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-15 20:31:26 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-18 05:04:19 from Bruce Momjian <bruce(at)momjian(dot)us>
2011-12-18 11:20:44 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-18 14:21:31 from Bruce Momjian <bruce(at)momjian(dot)us>
2011-12-18 18:52:32 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-18 19:54:11 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-18 21:17:57 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-18 22:11:00 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2011-12-19 02:02:04 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-19 14:31:17 from Greg Smith <greg(at)2ndQuadrant(dot)com>
2011-12-19 16:12:13 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-19 16:20:51 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-19 16:41:43 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-19 17:52:11 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2011-12-19 18:37:46 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-01-10 21:11:57 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-13 22:17:03 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-13 22:22:37 from Andres Freund <andres(at)anarazel(dot)de>
2012-01-13 22:53:32 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-14 00:23:20 from Andres Freund <andres(at)anarazel(dot)de>
2012-01-14 11:09:28 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-14 15:02:34 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-01-14 21:46:18 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-17 21:43:48 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-17 21:57:05 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-01-18 09:09:34 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-18 14:46:14 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-01-18 19:03:29 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-18 19:17:36 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2012-01-18 19:25:48 from Andres Freund <andres(at)anarazel(dot)de>
2012-01-18 21:23:14 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-20 03:00:15 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-01-20 14:28:40 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-20 15:03:53 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-01-20 17:14:47 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-20 18:14:20 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-01-20 19:27:50 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-01-20 19:59:59 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-26 22:00:39 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-07 12:51:33 from Simon Riggs <simon(at)2ndQuadrant(dot)com>
2012-02-14 21:29:05 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-15 16:36:46 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-15 20:25:08 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-15 21:11:43 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-15 21:32:33 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-15 22:21:42 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-16 17:42:26 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-16 20:53:53 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-16 21:21:30 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-16 22:19:54 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-16 22:38:47 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 05:02:27 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-17 08:54:17 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 13:37:23 from Marko Kreen <markokr(at)gmail(dot)com>
2012-02-17 14:04:48 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 14:12:06 from Marko Kreen <markokr(at)gmail(dot)com>
2012-02-17 14:11:08 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-17 15:42:59 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 17:06:05 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 17:07:44 from Robert Haas <robertmhaas(at)gmail(dot)com>
2012-02-17 17:45:29 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-18 21:24:01 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-16 21:19:57 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2012-02-16 21:30:49 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 13:19:21 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-02-17 13:31:56 from Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
2012-01-18 19:31:49 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2012-01-18 20:51:49 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-19 16:22:54 from Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
2011-12-19 18:25:38 from Greg Smith <greg(at)2ndQuadrant(dot)com>
2011-12-19 14:39:44 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2011-12-02 22:09:47 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-03 00:09:48 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2011-12-03 00:16:47 from Robert Haas <robertmhaas(at)gmail(dot)com>
2011-12-03 00:26:22 from Andres Freund <andres(at)anarazel(dot)de>
2011-12-05 15:29:53 from Ross Reedstrom <reedstrm(at)rice(dot)edu>
Lists:
pgsql-hackers
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I think the OID is better than the name, but if it's easy to pass the
> name and schema, then I'm fine with it. But I do think this is one of
It's quite easy to get name and schema from the command yes, here's an
example of how I'm doing it for some commands:
case T_CreateStmt:
{
CreateStmt *node = (CreateStmt *)parsetree;
cmd->schemaname = RangeVarGetNamespace(node->relation);
cmd->objectname = node->relation->relname;
break;
}
case T_AlterTableStmt:
{
AlterTableStmt *node = (AlterTableStmt *)parsetree;
cmd->schemaname = RangeVarGetNamespace(node->relation);
cmd->objectname = node->relation->relname;
break;
}
case T_CreateExtensionStmt:
{
cmd->schemaname = NULL;
cmd->objectname = ((CreateExtensionStmt *)parsetree)->extname;
break;
}
Getting the OID on the other hand is much harder, because each command
implements that part as it wants to, and DefineWhatever() functions are
returning void. We could maybe have them return the main Oid of the
object created, or we could have the CommandContext structure I'm using
be a backend global variable that any command would stuff.
In any case, adding support for the OID only works for after trigger
when talking about CREATE commands and for before trigger if talking
about DROP commands, assuming that the trigger procedure is run after
we've been locating said Oid.
It seems to me to be a couple orders of magnitude more work to get the
Oid here compared to just get the schemaname and objectname. And getting
those works in all cases as we take them from the command itself (we
fill in the schema with the first search_path entry when it's not given
explicitly in the command)
CREATE TABLE foo();
NOTICE: tag: CREATE TABLE
NOTICE: enforce_local_style{public.foo}: foo
> those problems that is complex enough that we should be happy to get
> the core infrastructure in in the first commit, even with an extremely
> limited amount of functionality, and then build on it.
> Enhance-and-extend is so much easier than a monolithic code drop.
I'm happy to read that, and I'm preparing next patch version (v6) with
that goal in mind.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
In response to
Responses
pgsql-hackers by date
Next :From: Kevin GrittnerDate: 2012-01-20 17:30:41
Subject : Re: Remembering bug #6123
Previous :From : David E. WheelerDate : 2012-01-20 17:14:35
Subject : Re: JSON for PG 9.2