Provide a function to emit DDL for CREATE EVENT TRIGGER#1
Provide a function to emit DDL for CREATE EVENT TRIGGER#1
Conversation
71e2b03 to
f3d9da2
Compare
1466737 to
a5c96cc
Compare
doc/src/sgml/func/func-info.sgml
Outdated
| </para> | ||
| <para> | ||
| Reconstructs the underlying DDL statement for a specified event trigger. | ||
| It returns the complete CREATE EVENT TRIGGER statement. For example, |
There was a problem hiding this comment.
I wonder if the example will be seen as too much info for the function documentation, as if output examples are provided at all they tend to be one-liners (see e.g https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE ), and a dozen or so retail DDL functions all with their own examples might look a bit bloated and repetitive.
(Personally I'm all in favour of examples for everything, but the Pg docs structure for functions in particular is not very conducive to that).
doc/src/sgml/func/func-info.sgml
Outdated
| <primary>pg_get_event_trigger_ddl</primary> | ||
| </indexterm> | ||
| <function>pg_get_event_trigger_ddl</function> | ||
| (<parameter>event trigger name</parameter> <type>name</type>) |
There was a problem hiding this comment.
Use of the name type is clever; I wonder if all the retail DDL functions should take type name?
There was a problem hiding this comment.
If the function parameter corresponds to a (system catalogue) column of type name (and there's no corresponding regXXX object identifier type), then it should be defined as such.
doc/src/sgml/func/func-info.sgml
Outdated
| <primary>pg_get_event_trigger_ddl</primary> | ||
| </indexterm> | ||
| <function>pg_get_event_trigger_ddl</function> | ||
| (<parameter>event trigger name</parameter> <type>name</type>) |
There was a problem hiding this comment.
The parameter name should be joined with underscores, i.e. <parameter>event_trigger_name</parameter>.
akshay-joshi
left a comment
There was a problem hiding this comment.
The PR contains extra whitespace. Could you please run pgindent to clean it up?
f664e94 to
b2382b0
Compare
|
Removed whitespace |
This patch implements the pg_get_event_trigger_ddl() function, which emits
the DDL for CREATE EVENT TRIGGER. It includes functionality comments in the code,
as well as tests and documentation.
The returned function will look like the following:
postgres=# SELECT pg_get_event_trigger_ddl('foo_event_trigger');
pg_get_event_trigger_ddl
---------------------------------------------------------------------------------------------------------------
CREATE EVENT TRIGGER foo_event_trigger ON ddl_command_start EXECUTE FUNCTION public.test_event_trigger();
(1 row)
or with a TAG filter:
postgres=# SELECT pg_get_event_trigger_ddl('foo_event_trigger2');
pg_get_event_trigger_ddl
---------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE EVENT TRIGGER foo_event_trigger2 ON ddl_command_start WHEN TAG IN ('CREATE TABLE','CREATE FUNCTION') EXECUTE FUNCTION public.test_event_trigger();
PG-158
Author: Ian Barwick <barwick@gmail.com>
Co-authored-by: Phil Alger <phil.alger@enterprisedb.com>
truncate_useless_pathkeys() seems to have neglected to account for PathKeys that might be useful for WindowClause evaluation. Modify it so that it properly accounts for that. Making this work required adjusting two things: 1. Change from checking query_pathkeys to check sort_pathkeys instead. 2. Add explicit check for window_pathkeys For #1, query_pathkeys gets set in standard_qp_callback() according to the sort order requirements for the first operation to be applied after the join planner is finished, so this changes depending on which upper planner operations a particular query needs. If the query has window functions and no GROUP BY, then query_pathkeys gets set to window_pathkeys. Before this change, this meant PathKeys useful for the ORDER BY were not accounted for in queries with window functions. Because of #1, #2 is now required so that we explicitly check to ensure we don't truncate away PathKeys useful for window functions. Author: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/CAApHDvrj3HTKmXoLMbUjTO=_MNMxM=cnuCSyBKidAVibmYPnrg@mail.gmail.com
cost_tidrangescan() was setting the disabled_nodes value correctly, and then immediately resetting it to zero, due to poor code editing on my part. materialized_finished_plan correctly set matpath.parent to zero, but forgot to also set matpath.parallel_workers = 0, causing an access to uninitialized memory in cost_material. (This shouldn't result in any real problem, but it makes valgrind unhappy.) reparameterize_path was dereferencing a variable before verifying that it was not NULL. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (issue #1) Reported-by: Michael Paquier <michael@paquier.xyz> (issue #1) Diagnosed-by: Lukas Fittl <lukas@fittl.com> (issue #1) Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> (issue #2) Reported-by: Richard Guo <guofenglinux@gmail.com> (issue #3) Discussion: http://postgr.es/m/CAN4CZFPvwjNJEZ_JT9Y67yR7C=KMNa=LNefOB8ZY7TKDcmAXOA@mail.gmail.com Discussion: http://postgr.es/m/aXrnPgrq6Gggb5TG@paquier.xyz
This patch implements the pg_get_event_trigger_ddl() function, which emits the DDL for CREATE EVENT TRIGGER.
It includes documentation and tests.
PG-158
Author: Ian Barwick barwick@gmail.com
Co-authored-by: Phil Alger phil.alger@enterprisedb.com