-
Notifications
You must be signed in to change notification settings - Fork 3.9k
sql/triggers: populate information_schema.triggers #143534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
A-sql-trigger
Triggers and Trigger Functions
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-queries
SQL Queries Team
target-release-25.3.0
Comments
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
May 23, 2025
Previously, the information_schema.triggers table was unimplemented and always returned zero rows. This made it impossible to query trigger metadata through standard SQL information schema views. This change implements the populate function for information_schema.triggers, allowing users to query trigger information. The implementation: Note that transition tables (action_reference_old_table/new_table) will only be populated once statement-level triggers are supported. Currently, these columns return NULL for row-level triggers. Fixes cockroachdb#143534 Release note (sql change): The information_schema.triggers table is now populated with trigger metadata. Users can query this table to see all triggers defined in their database, including the trigger name, timing (BEFORE/AFTER), event type (INSERT/UPDATE/DELETE), and associated function. Each trigger event appears as a separate row in the table.
craig bot
pushed a commit
that referenced
this issue
May 23, 2025
147087: xform: increase pool size for "heavy" configs r=yuzefovich a=yuzefovich We just saw an engflow failure that looks like an OOM under deadlock config, so let's bump the size. Fixes: #146867. Release note: None 147182: row/fetcher: clean up and harden TestRowFetcherMVCCMetadata r=yuzefovich a=yuzefovich This commit refactors `TestRowFetcherMVCCMetadata` a bit to explicitly request `crdb_internal_mvcc_timestamp` as opposed to fishing it out of the fetcher, which allows removing an exported method from the latter. This commit also hardens the test to de-flake it when write buffering is enabled. The test scans the storage engine directly, so we need to tweak a testing knob to ensure that COMMIT blocks until the writes are committed into pebble. Fixes: #147174. Release note: None 147237: sql: populate information_schema.triggers r=rafiss a=rafiss Previously, the information_schema.triggers table was unimplemented and always returned zero rows. This made it impossible to query trigger metadata through standard SQL information schema views. This change implements the populate function for information_schema.triggers, allowing users to query trigger information. The implementation: Note that transition tables (action_reference_old_table/new_table) will only be populated once statement-level triggers are supported. Currently, these columns return NULL for row-level triggers. Fixes #143534 Release note (sql change): The information_schema.triggers table is now populated with trigger metadata. Users can query this table to see all triggers defined in their database, including the trigger name, timing (BEFORE/AFTER), event type (INSERT/UPDATE/DELETE), and associated function. Each trigger event appears as a separate row in the table. Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Rafi Shamim <[email protected]>
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
May 23, 2025
This commit populates the pg_catalog.pg_trigger virtual table, which provides metadata about database triggers. The implementation includes: - Correct calculation of the tgtype bitmap field according to PostgreSQL's specification, where bits represent: - Bit 0: FOR EACH ROW (1) or FOR EACH STATEMENT (0) - Bit 1: BEFORE timing - Bits 2-4: Event types (INSERT=4, DELETE=8, UPDATE=16) - Bit 5: TRUNCATE (32) - reserved for future use - Bit 6: INSTEAD OF (64) - reserved for future use - Support for trigger function arguments stored in tgargs as a null-separated bytea array. - WHEN clause conditions stored in tgqual The tgenabled field always returns 'A' (always enabled) as CockroachDB does not yet support trigger enable/disable states. Tests are added to verify the pg_trigger contents, including the tgtype bitmap calculation and triggers with function arguments. Fixes cockroachdb#143534 Release note (sql change): The pg_catalog.pg_trigger table now returns metadata about database triggers.
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
May 25, 2025
This commit populates the pg_catalog.pg_trigger virtual table, which provides metadata about database triggers. The implementation includes: - Correct calculation of the tgtype bitmap field according to PostgreSQL's specification, where bits represent: - Bit 0: FOR EACH ROW (1) or FOR EACH STATEMENT (0) - Bit 1: BEFORE timing - Bits 2-4: Event types (INSERT=4, DELETE=8, UPDATE=16) - Bit 5: TRUNCATE (32) - reserved for future use - Bit 6: INSTEAD OF (64) - reserved for future use - Support for trigger function arguments stored in tgargs as a null-separated bytea array. - WHEN clause conditions stored in tgqual The tgenabled field always returns 'A' (always enabled) as CockroachDB does not yet support trigger enable/disable states. Tests are added to verify the pg_trigger contents, including the tgtype bitmap calculation and triggers with function arguments. Fixes cockroachdb#143534 Release note (sql change): The pg_catalog.pg_trigger table now returns metadata about database triggers.
Dev-Kyle
pushed a commit
to Dev-Kyle/cockroach
that referenced
this issue
May 27, 2025
Previously, the information_schema.triggers table was unimplemented and always returned zero rows. This made it impossible to query trigger metadata through standard SQL information schema views. This change implements the populate function for information_schema.triggers, allowing users to query trigger information. The implementation: Note that transition tables (action_reference_old_table/new_table) will only be populated once statement-level triggers are supported. Currently, these columns return NULL for row-level triggers. Fixes cockroachdb#143534 Release note (sql change): The information_schema.triggers table is now populated with trigger metadata. Users can query this table to see all triggers defined in their database, including the trigger name, timing (BEFORE/AFTER), event type (INSERT/UPDATE/DELETE), and associated function. Each trigger event appears as a separate row in the table.
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
May 27, 2025
This commit populates the pg_catalog.pg_trigger virtual table, which provides metadata about database triggers. The implementation includes: - Correct calculation of the tgtype bitmap field according to PostgreSQL's specification, where bits represent: - Bit 0: FOR EACH ROW (1) or FOR EACH STATEMENT (0) - Bit 1: BEFORE timing - Bits 2-4: Event types (INSERT=4, DELETE=8, UPDATE=16) - Bit 5: TRUNCATE (32) - reserved for future use - Bit 6: INSTEAD OF (64) - reserved for future use - Support for trigger function arguments stored in tgargs as a null-separated bytea array. - WHEN clause conditions stored in tgqual The tgenabled field always returns 'A' (always enabled) as CockroachDB does not yet support trigger enable/disable states. Tests are added to verify the pg_trigger contents, including the tgtype bitmap calculation and triggers with function arguments. Fixes cockroachdb#143534 Release note (sql change): The pg_catalog.pg_trigger table now returns metadata about database triggers.
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
May 28, 2025
This commit populates the pg_catalog.pg_trigger virtual table, which provides metadata about database triggers. The implementation includes: - Correct calculation of the tgtype bitmap field according to PostgreSQL's specification, where bits represent: - Bit 0: FOR EACH ROW (1) or FOR EACH STATEMENT (0) - Bit 1: BEFORE timing - Bits 2-4: Event types (INSERT=4, DELETE=8, UPDATE=16) - Bit 5: TRUNCATE (32) - reserved for future use - Bit 6: INSTEAD OF (64) - reserved for future use - Support for trigger function arguments stored in tgargs as a null-separated bytea array. - WHEN clause conditions stored in tgqual The tgenabled field always returns 'A' (always enabled) as CockroachDB does not yet support trigger enable/disable states. Tests are added to verify the pg_trigger contents, including the tgtype bitmap calculation and triggers with function arguments. Fixes cockroachdb#143534 Release note (sql change): The pg_catalog.pg_trigger table now returns metadata about database triggers.
craig bot
pushed a commit
that referenced
this issue
May 28, 2025
147248: sql: populate pg_catalog.pg_trigger r=rafiss a=rafiss This commit populates the pg_catalog.pg_trigger virtual table, which provides metadata about database triggers. The implementation includes: - Correct calculation of the tgtype bitmap field according to PostgreSQL's specification, where bits represent: - Bit 0: FOR EACH ROW (1) or FOR EACH STATEMENT (0) - Bit 1: BEFORE timing - Bits 2-4: Event types (INSERT=4, DELETE=8, UPDATE=16) - Bit 5: TRUNCATE (32) - reserved for future use - Bit 6: INSTEAD OF (64) - reserved for future use - Support for trigger function arguments stored in tgargs as a null-separated bytea array. - WHEN clause conditions stored in tgqual The tgenabled field always returns 'A' (always enabled) as CockroachDB does not yet support trigger enable/disable states. Tests are added to verify the pg_trigger contents, including the tgtype bitmap calculation and triggers with function arguments. informs #143534 Epic: CRDB-42942 Release note (sql change): The pg_catalog.pg_trigger table now returns metadata about database triggers. Co-authored-by: Rafi Shamim <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-sql-trigger
Triggers and Trigger Functions
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-queries
SQL Queries Team
target-release-25.3.0
Uh oh!
There was an error while loading. Please reload this page.
Right now information_schema.trigger does not seem to be populated. This would be useful to see what triggers are available in a database. eg: link
Jira issue: CRDB-48891
The text was updated successfully, but these errors were encountered: