Re: delta relations in AFTER triggers
Kevin Grittner <kgrittn@ymail.com>
From: Kevin Grittner <kgrittn@ymail.com>
To: Amit Khandekar <amit.khandekar@enterprisedb.com>
Cc: Robert Haas <robertmhaas@gmail.com>, David Fetter <david@fetter.org>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2014-08-14T22:34:57Z
Lists: pgsql-hackers
Amit Khandekar <amit.khandekar@enterprisedb.com> wrote: >>> The execution level itself was almost trivial; it's getting the >>> tuplestore reference through the parse analysis and planning >>> phases that is painful for me. >> I am not sure why you think we would need to refer the >> tuplestore in the parse analysis and planner phases. It seems >> that we would need them only in execution phase. Or may be I >> didn't understand your point. > Ah I think I understand now. That might be because you are > thinking of having an infrastructure common to triggers and > materialized views, right ? Well, it's more immediate than that. The identifiers in the trigger function are not resolved to particular objects until there is a request to fire the trigger. At that time the parse analysis needs to find the name defined somewhere. It's not defined in the catalogs like a table or view, and it's not defined in the query itself like a CTE or VALUES clause. The names specified in trigger creation must be recognized as needing to resolve to the new TuplestoreScan, and it needs to match those to the tuplestores themselves. Row counts, costing, etc. needs to be provided so the optimizer can pick a good plan in what might be a complex query with many options. I'm finding the planner work here to be harder than everything else put together. On the bright side, once I'm done, I might know enough about the planner to do things a lot faster next time. :-) -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Don't permit transition tables with TRUNCATE triggers.
- 29fd3d9da0ff 10.0 landed
-
Pass EXEC_FLAG_REWIND when initializing a tuplestore scan.
- 304007d9f1f6 10.0 landed
-
Faster expression evaluation and targetlist projection.
- b8d7f053c5c2 10.0 cited
-
Remove obsoleted code relating to targetlist SRF evaluation.
- ea15e18677fc 10.0 cited
-
Implement syntax for transition tables in AFTER triggers.
- 8c48375e5f43 10.0 cited