You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"commit":{"oid":"c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","url":"/postgres/postgres/commit/c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","authoredDate":"2023-12-07T08:31:02.000+09:00","committedDate":"2023-12-07T08:31:02.000+09:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eFix assertion failure with REINDEX and event triggers\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"A REINDEX CONCURRENTLY run on a table with no indexes would always pop\nthe topmost snapshot from the active snapshot stack, making the snapshot\nhandling inconsistent between the multiple-relation and single-relation\ncases. This commit slightly changes the snapshot stack handling so as a\nsnapshot is popped only ReindexMultipleInternal() in this case after a\nrelation has been reindexed, fixing a problem where an event trigger\nfunction may need a snapshot but does not have one. This also keeps the\nplaces where PopActiveSnapshot() is called closer to each other.\n\nWhile on it, this expands the existing tests to cover all the cases that\ncould be faced with REINDEX commands and such event triggers, for one or\nmore relations, with or without indexes.\n\nThis behavior is inconsistent since \u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/postgres/postgres/commit/5dc92b844e680c54a7ecd68de0ba53c949c3d605/hovercard\" href=\"https://github.com/postgres/postgres/commit/5dc92b844e680c54a7ecd68de0ba53c949c3d605\"\u003e\u003ctt\u003e5dc92b8\u003c/tt\u003e\u003c/a\u003e, but we've never had a\nneed for an active snapshot at the end of a REINDEX until now.\n\nThanks also to Jian He for the input.\n\nReported-by: Alexander Lakhin\nDiscussion: \u003ca href=\"https://postgr.es/m/cb538743-484c-eb6a-a8c5-359980cd3a17@gmail.com\" rel=\"nofollow\"\u003ehttps://postgr.es/m/cb538743-484c-eb6a-a8c5-359980cd3a17@gmail.com\u003c/a\u003e","authors":[{"login":"michaelpq","displayName":"Michael Paquier","avatarUrl":"https://avatars.githubusercontent.com/u/985332?v=4","path":"/michaelpq","isGitHub":false}],"committerAttribution":false,"committer":{"login":"michaelpq","displayName":"Michael Paquier","avatarUrl":"https://avatars.githubusercontent.com/u/985332?v=4","path":"/michaelpq","isGitHub":false},"parents":["c2a465b2c94fb44211c350f73b5a11978d3b4536"],"globalRelayId":"C_kwDOAA4m0toAKGM0MjZmN2MyYjM2YTVlZmQ5YmNlZjJhMmRmY2M1NTlmNzg3OWNkODQ","sha1":"c2a465b2c94fb44211c350f73b5a11978d3b4536","sha2":"c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":3346,"text":"@@ -3347,6 +3347,8 @@ ReindexMultipleInternal(const ReindexStmt *stmt, const List *relids, const Reind","html":"@@ -3347,6 +3347,8 @@ ReindexMultipleInternal(const ReindexStmt *stmt, const List *relids, const Reind","displayNoNewLineWarning":false,"position":0,"left":3346,"right":3346},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3347,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":3347,"right":3347},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3348,"text":" \t\t\tnewparams.options |= REINDEXOPT_MISSING_OK;","html":" \t\t\t\u003cspan class=pl-s1\u003enewparams\u003c/span\u003e.\u003cspan class=pl-c1\u003eoptions\u003c/span\u003e |= \u003cspan class=pl-c1\u003eREINDEXOPT_MISSING_OK\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":3348,"right":3348},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3349,"text":" \t\t\t(void) ReindexRelationConcurrently(stmt, relid, \u0026newparams);","html":" \t\t\t(\u003cspan class=pl-smi\u003evoid\u003c/span\u003e) \u003cspan class=pl-en\u003eReindexRelationConcurrently\u003c/span\u003e(\u003cspan class=pl-s1\u003estmt\u003c/span\u003e, \u003cspan class=pl-s1\u003erelid\u003c/span\u003e, \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003enewparams\u003c/span\u003e);","displayNoNewLineWarning":false,"position":3,"left":3349,"right":3349},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3350,"text":"+\t\t\tif (ActiveSnapshotSet())","html":"+\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eActiveSnapshotSet\u003c/span\u003e())","displayNoNewLineWarning":false,"position":4,"left":3349,"right":3350},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3351,"text":"+\t\t\t\tPopActiveSnapshot();","html":"+\t\t\t\t\u003cspan class=pl-en\u003ePopActiveSnapshot\u003c/span\u003e();","displayNoNewLineWarning":false,"position":5,"left":3349,"right":3351},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3352,"text":" \t\t\t/* ReindexRelationConcurrently() does the verbose output */","html":" \t\t\t\u003cspan class=pl-c\u003e/* ReindexRelationConcurrently() does the verbose output */\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":3350,"right":3352},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3353,"text":" \t\t}","html":" \t\t}","displayNoNewLineWarning":false,"position":7,"left":3351,"right":3353},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3354,"text":" \t\telse if (relkind == RELKIND_INDEX)","html":" \t\t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003erelkind\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eRELKIND_INDEX\u003c/span\u003e)","displayNoNewLineWarning":false,"position":8,"left":3352,"right":3354},{"stylingDirective":null,"type":"HUNK","blobLineNumber":3699,"text":"@@ -3698,10 +3700,7 @@ ReindexRelationConcurrently(const ReindexStmt *stmt, Oid relationOid, const Rein","html":"@@ -3698,10 +3700,7 @@ ReindexRelationConcurrently(const ReindexStmt *stmt, Oid relationOid, const Rein","displayNoNewLineWarning":false,"position":9,"left":3697,"right":3699},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3700,"text":" \t * session until this operation completes.","html":" \u003cspan class=pl-c\u003e\t * session until this operation completes.\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":3698,"right":3700},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3701,"text":" \t */","html":" \u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":3699,"right":3701},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3702,"text":" \tif (indexIds == NIL)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003eindexIds\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":12,"left":3700,"right":3702},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3701,"text":"-\t{","html":"-\t{","displayNoNewLineWarning":false,"position":13,"left":3701,"right":3702},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3702,"text":"-\t\tPopActiveSnapshot();","html":"-\t\t\u003cspan class=pl-en\u003ePopActiveSnapshot\u003c/span\u003e();","displayNoNewLineWarning":false,"position":14,"left":3702,"right":3702},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3703,"text":" \t\treturn false;","html":" \t\t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e false;","displayNoNewLineWarning":false,"position":15,"left":3703,"right":3703},{"stylingDirective":null,"type":"DELETION","blobLineNumber":3704,"text":"-\t}","html":"-\t}","displayNoNewLineWarning":false,"position":16,"left":3704,"right":3703},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3704,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":17,"left":3705,"right":3704},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3705,"text":" \t/* It's not a shared catalog, so refuse to move it to shared tablespace */","html":" \t\u003cspan class=pl-c\u003e/* It\u0026#39;s not a shared catalog, so refuse to move it to shared tablespace */\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":3706,"right":3705},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":3706,"text":" \tif (params-\u003etablespaceOid == GLOBALTABLESPACE_OID)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003eparams\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etablespaceOid\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eGLOBALTABLESPACE_OID\u003c/span\u003e)","displayNoNewLineWarning":false,"position":19,"left":3707,"right":3706}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":4441,"linesChanged":5,"newTreeEntry":{"lineCount":4441,"path":"src/backend/commands/indexcmds.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/commands/indexcmds.c","mode":100644},"linesAdded":2,"linesDeleted":3,"path":"src/backend/commands/indexcmds.c","pathDigest":"111f77b321d894beea2b6a25406b3d540e5e2441c3f13841b60c0bb5bb961063","status":"MODIFIED","truncatedReason":null,"oldOid":"c2a465b2c94fb44211c350f73b5a11978d3b4536","newOid":"c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","copilotChatReference":null,"deletedSha":"c2a465b2c94fb44211c350f73b5a11978d3b4536","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":580,"text":"@@ -581,6 +581,12 @@ $$ LANGUAGE plpgsql;","html":"@@ -581,6 +581,12 @@ $$ LANGUAGE plpgsql;","displayNoNewLineWarning":false,"position":0,"left":580,"right":580},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":581,"text":" CREATE EVENT TRIGGER regress_reindex_end ON ddl_command_end","html":" CREATE EVENT TRIGGER regress_reindex_end ON ddl_command_end","displayNoNewLineWarning":false,"position":1,"left":581,"right":581},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":582,"text":" WHEN TAG IN ('REINDEX')","html":" WHEN TAG IN (\u0026#39;REINDEX\u0026#39;)","displayNoNewLineWarning":false,"position":2,"left":582,"right":582},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":583,"text":" EXECUTE PROCEDURE reindex_end_command();","html":" EXECUTE PROCEDURE reindex_end_command();","displayNoNewLineWarning":false,"position":3,"left":583,"right":583},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":584,"text":"+-- Extra event to force the use of a snapshot.","html":"+-- Extra event to force the use of a snapshot.","displayNoNewLineWarning":false,"position":4,"left":583,"right":584},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":585,"text":"+CREATE FUNCTION reindex_end_command_snap() RETURNS EVENT_TRIGGER","html":"+CREATE FUNCTION reindex_end_command_snap() RETURNS EVENT_TRIGGER","displayNoNewLineWarning":false,"position":5,"left":583,"right":585},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":586,"text":"+ AS $$ BEGIN PERFORM 1; END $$ LANGUAGE plpgsql;","html":"+ AS $$ BEGIN PERFORM 1; END $$ LANGUAGE plpgsql;","displayNoNewLineWarning":false,"position":6,"left":583,"right":586},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":587,"text":"+CREATE EVENT TRIGGER regress_reindex_end_snap ON ddl_command_end","html":"+CREATE EVENT TRIGGER regress_reindex_end_snap ON ddl_command_end","displayNoNewLineWarning":false,"position":7,"left":583,"right":587},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":588,"text":"+ EXECUTE FUNCTION reindex_end_command_snap();","html":"+ EXECUTE FUNCTION reindex_end_command_snap();","displayNoNewLineWarning":false,"position":8,"left":583,"right":588},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":589,"text":"+-- With simple relation","html":"+-- With simple relation","displayNoNewLineWarning":false,"position":9,"left":583,"right":589},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":590,"text":" CREATE TABLE concur_reindex_tab (c1 int);","html":" CREATE TABLE concur_reindex_tab (c1 int);","displayNoNewLineWarning":false,"position":10,"left":584,"right":590},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":591,"text":" CREATE INDEX concur_reindex_ind ON concur_reindex_tab (c1);","html":" CREATE INDEX concur_reindex_ind ON concur_reindex_tab (c1);","displayNoNewLineWarning":false,"position":11,"left":585,"right":591},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":592,"text":" -- Both start and end triggers enabled.","html":" -- Both start and end triggers enabled.","displayNoNewLineWarning":false,"position":12,"left":586,"right":592},{"stylingDirective":null,"type":"HUNK","blobLineNumber":607,"text":"@@ -602,10 +608,56 @@ REINDEX INDEX concur_reindex_ind;","html":"@@ -602,10 +608,56 @@ REINDEX INDEX concur_reindex_ind;","displayNoNewLineWarning":false,"position":13,"left":601,"right":607},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":608,"text":" NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_ind","html":" NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_ind","displayNoNewLineWarning":false,"position":14,"left":602,"right":608},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":609,"text":" REINDEX INDEX CONCURRENTLY concur_reindex_ind;","html":" REINDEX INDEX CONCURRENTLY concur_reindex_ind;","displayNoNewLineWarning":false,"position":15,"left":603,"right":609},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":610,"text":" NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_ind","html":" NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_ind","displayNoNewLineWarning":false,"position":16,"left":604,"right":610},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":611,"text":"+-- without an index","html":"+-- without an index","displayNoNewLineWarning":false,"position":17,"left":604,"right":611},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":612,"text":"+DROP INDEX concur_reindex_ind;","html":"+DROP INDEX concur_reindex_ind;","displayNoNewLineWarning":false,"position":18,"left":604,"right":612},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":613,"text":"+REINDEX TABLE concur_reindex_tab;","html":"+REINDEX TABLE concur_reindex_tab;","displayNoNewLineWarning":false,"position":19,"left":604,"right":613},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":614,"text":"+NOTICE: table \"concur_reindex_tab\" has no indexes to reindex","html":"+NOTICE: table \u0026quot;concur_reindex_tab\u0026quot; has no indexes to reindex","displayNoNewLineWarning":false,"position":20,"left":604,"right":614},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":615,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_tab;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_tab;","displayNoNewLineWarning":false,"position":21,"left":604,"right":615},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":616,"text":"+NOTICE: table \"concur_reindex_tab\" has no indexes that can be reindexed concurrently","html":"+NOTICE: table \u0026quot;concur_reindex_tab\u0026quot; has no indexes that can be reindexed concurrently","displayNoNewLineWarning":false,"position":22,"left":604,"right":616},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":617,"text":"+-- With a Schema","html":"+-- With a Schema","displayNoNewLineWarning":false,"position":23,"left":604,"right":617},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":618,"text":"+CREATE SCHEMA concur_reindex_schema;","html":"+CREATE SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":24,"left":604,"right":618},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":619,"text":"+-- No indexes","html":"+-- No indexes","displayNoNewLineWarning":false,"position":25,"left":604,"right":619},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":620,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":26,"left":604,"right":620},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":621,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":27,"left":604,"right":621},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":622,"text":"+CREATE TABLE concur_reindex_schema.tab (a int);","html":"+CREATE TABLE concur_reindex_schema.tab (a int);","displayNoNewLineWarning":false,"position":28,"left":604,"right":622},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":623,"text":"+CREATE INDEX ind ON concur_reindex_schema.tab (a);","html":"+CREATE INDEX ind ON concur_reindex_schema.tab (a);","displayNoNewLineWarning":false,"position":29,"left":604,"right":623},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":624,"text":"+-- One index reported","html":"+-- One index reported","displayNoNewLineWarning":false,"position":30,"left":604,"right":624},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":625,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":31,"left":604,"right":625},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":626,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=concur_reindex_schema.ind","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=concur_reindex_schema.ind","displayNoNewLineWarning":false,"position":32,"left":604,"right":626},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":627,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":33,"left":604,"right":627},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":628,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=concur_reindex_schema.ind","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=concur_reindex_schema.ind","displayNoNewLineWarning":false,"position":34,"left":604,"right":628},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":629,"text":"+-- One table on schema but no indexes","html":"+-- One table on schema but no indexes","displayNoNewLineWarning":false,"position":35,"left":604,"right":629},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":630,"text":"+DROP INDEX concur_reindex_schema.ind;","html":"+DROP INDEX concur_reindex_schema.ind;","displayNoNewLineWarning":false,"position":36,"left":604,"right":630},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":631,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":37,"left":604,"right":631},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":632,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":38,"left":604,"right":632},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":633,"text":"+DROP SCHEMA concur_reindex_schema CASCADE;","html":"+DROP SCHEMA concur_reindex_schema CASCADE;","displayNoNewLineWarning":false,"position":39,"left":604,"right":633},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":634,"text":"+NOTICE: drop cascades to table concur_reindex_schema.tab","html":"+NOTICE: drop cascades to table concur_reindex_schema.tab","displayNoNewLineWarning":false,"position":40,"left":604,"right":634},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":635,"text":"+-- With a partitioned table, and nothing else.","html":"+-- With a partitioned table, and nothing else.","displayNoNewLineWarning":false,"position":41,"left":604,"right":635},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":636,"text":"+CREATE TABLE concur_reindex_part (id int) PARTITION BY RANGE (id);","html":"+CREATE TABLE concur_reindex_part (id int) PARTITION BY RANGE (id);","displayNoNewLineWarning":false,"position":42,"left":604,"right":636},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":637,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":43,"left":604,"right":637},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":638,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":44,"left":604,"right":638},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":639,"text":"+-- Partition that would be reindexed, still nothing.","html":"+-- Partition that would be reindexed, still nothing.","displayNoNewLineWarning":false,"position":45,"left":604,"right":639},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":640,"text":"+CREATE TABLE concur_reindex_child PARTITION OF concur_reindex_part","html":"+CREATE TABLE concur_reindex_child PARTITION OF concur_reindex_part","displayNoNewLineWarning":false,"position":46,"left":604,"right":640},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":641,"text":"+ FOR VALUES FROM (0) TO (10);","html":"+ FOR VALUES FROM (0) TO (10);","displayNoNewLineWarning":false,"position":47,"left":604,"right":641},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":642,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":48,"left":604,"right":642},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":643,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":49,"left":604,"right":643},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":644,"text":"+-- Now add some indexes.","html":"+-- Now add some indexes.","displayNoNewLineWarning":false,"position":50,"left":604,"right":644},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":645,"text":"+CREATE INDEX concur_reindex_partidx ON concur_reindex_part (id);","html":"+CREATE INDEX concur_reindex_partidx ON concur_reindex_part (id);","displayNoNewLineWarning":false,"position":51,"left":604,"right":645},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":646,"text":"+REINDEX INDEX concur_reindex_partidx;","html":"+REINDEX INDEX concur_reindex_partidx;","displayNoNewLineWarning":false,"position":52,"left":604,"right":646},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":647,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","displayNoNewLineWarning":false,"position":53,"left":604,"right":647},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":648,"text":"+REINDEX INDEX CONCURRENTLY concur_reindex_partidx;","html":"+REINDEX INDEX CONCURRENTLY concur_reindex_partidx;","displayNoNewLineWarning":false,"position":54,"left":604,"right":648},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":649,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","displayNoNewLineWarning":false,"position":55,"left":604,"right":649},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":650,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":56,"left":604,"right":650},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":651,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","displayNoNewLineWarning":false,"position":57,"left":604,"right":651},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":652,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":58,"left":604,"right":652},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":653,"text":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","html":"+NOTICE: REINDEX END: command_tag=REINDEX type=index identity=public.concur_reindex_child_id_idx","displayNoNewLineWarning":false,"position":59,"left":604,"right":653},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":654,"text":"+DROP TABLE concur_reindex_part;","html":"+DROP TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":60,"left":604,"right":654},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":655,"text":" -- Clean up","html":" -- Clean up","displayNoNewLineWarning":false,"position":61,"left":605,"right":655},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":656,"text":" DROP EVENT TRIGGER regress_reindex_start;","html":" DROP EVENT TRIGGER regress_reindex_start;","displayNoNewLineWarning":false,"position":62,"left":606,"right":656},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":657,"text":" DROP EVENT TRIGGER regress_reindex_end;","html":" DROP EVENT TRIGGER regress_reindex_end;","displayNoNewLineWarning":false,"position":63,"left":607,"right":657},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":658,"text":"+DROP EVENT TRIGGER regress_reindex_end_snap;","html":"+DROP EVENT TRIGGER regress_reindex_end_snap;","displayNoNewLineWarning":false,"position":64,"left":607,"right":658},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":659,"text":" DROP FUNCTION reindex_end_command();","html":" DROP FUNCTION reindex_end_command();","displayNoNewLineWarning":false,"position":65,"left":608,"right":659},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":660,"text":"+DROP FUNCTION reindex_end_command_snap();","html":"+DROP FUNCTION reindex_end_command_snap();","displayNoNewLineWarning":false,"position":66,"left":608,"right":660},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":661,"text":" DROP FUNCTION reindex_start_command();","html":" DROP FUNCTION reindex_start_command();","displayNoNewLineWarning":false,"position":67,"left":609,"right":661},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":662,"text":" DROP TABLE concur_reindex_tab;","html":" DROP TABLE concur_reindex_tab;","displayNoNewLineWarning":false,"position":68,"left":610,"right":662},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":663,"text":" -- test Row Security Event Trigger","html":" -- test Row Security Event Trigger","displayNoNewLineWarning":false,"position":69,"left":611,"right":663}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":744,"linesChanged":52,"newTreeEntry":{"lineCount":744,"path":"src/test/regress/expected/event_trigger.out","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/expected/event_trigger.out","mode":100644},"linesAdded":52,"linesDeleted":0,"path":"src/test/regress/expected/event_trigger.out","pathDigest":"699cc59bb7db1ee31e07fa8ba883410b9fe7ab77c94995a010be7ab942489d6a","status":"MODIFIED","truncatedReason":null,"oldOid":"c2a465b2c94fb44211c350f73b5a11978d3b4536","newOid":"c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","copilotChatReference":null,"deletedSha":"c2a465b2c94fb44211c350f73b5a11978d3b4536","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":442,"text":"@@ -443,7 +443,13 @@ $$ LANGUAGE plpgsql;","html":"@@ -443,7 +443,13 @@ $$ LANGUAGE plpgsql;","displayNoNewLineWarning":false,"position":0,"left":442,"right":442},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":443,"text":" CREATE EVENT TRIGGER regress_reindex_end ON ddl_command_end","html":" CREATE EVENT TRIGGER regress_reindex_end \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e ddl_command_end","displayNoNewLineWarning":false,"position":1,"left":443,"right":443},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":444,"text":" WHEN TAG IN ('REINDEX')","html":" WHEN TAG \u003cspan class=\"pl-k\"\u003eIN\u003c/span\u003e (\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eREINDEX\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e)","displayNoNewLineWarning":false,"position":2,"left":444,"right":444},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":445,"text":" EXECUTE PROCEDURE reindex_end_command();","html":" EXECUTE PROCEDURE reindex_end_command();","displayNoNewLineWarning":false,"position":3,"left":445,"right":445},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":446,"text":"+-- Extra event to force the use of a snapshot.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Extra event to force the use of a snapshot.\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":445,"right":446},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":447,"text":"+CREATE FUNCTION reindex_end_command_snap() RETURNS EVENT_TRIGGER","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ereindex_end_command_snap\u003c/span\u003e() RETURNS EVENT_TRIGGER","displayNoNewLineWarning":false,"position":5,"left":445,"right":447},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":448,"text":"+ AS $$ BEGIN PERFORM 1; END $$ LANGUAGE plpgsql;","html":"+ \u003cspan class=\"pl-k\"\u003eAS\u003c/span\u003e $$ \u003cspan class=\"pl-k\"\u003eBEGIN\u003c/span\u003e PERFORM \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e; END $$ LANGUAGE plpgsql;","displayNoNewLineWarning":false,"position":6,"left":445,"right":448},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":449,"text":"+CREATE EVENT TRIGGER regress_reindex_end_snap ON ddl_command_end","html":"+CREATE EVENT TRIGGER regress_reindex_end_snap \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e ddl_command_end","displayNoNewLineWarning":false,"position":7,"left":445,"right":449},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":450,"text":"+ EXECUTE FUNCTION reindex_end_command_snap();","html":"+ EXECUTE FUNCTION reindex_end_command_snap();","displayNoNewLineWarning":false,"position":8,"left":445,"right":450},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":451,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":9,"left":446,"right":451},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":452,"text":"+-- With simple relation","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e With simple relation\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":446,"right":452},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":453,"text":" CREATE TABLE concur_reindex_tab (c1 int);","html":" \u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_tab\u003c/span\u003e (c1 \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e);","displayNoNewLineWarning":false,"position":11,"left":447,"right":453},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":454,"text":" CREATE INDEX concur_reindex_ind ON concur_reindex_tab (c1);","html":" \u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eINDEX\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_ind\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e concur_reind
8000
ex_tab (c1);","displayNoNewLineWarning":false,"position":12,"left":448,"right":454},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":455,"text":" -- Both start and end triggers enabled.","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Both start and end triggers enabled.\u003c/span\u003e","displayNoNewLineWarning":false,"position":13,"left":449,"right":455},{"stylingDirective":null,"type":"HUNK","blobLineNumber":460,"text":"@@ -455,11 +461,50 @@ REINDEX TABLE CONCURRENTLY concur_reindex_tab;","html":"@@ -455,11 +461,50 @@ REINDEX TABLE CONCURRENTLY concur_reindex_tab;","displayNoNewLineWarning":false,"position":14,"left":454,"right":460},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":461,"text":" ALTER EVENT TRIGGER regress_reindex_start DISABLE;","html":" ALTER EVENT TRIGGER regress_reindex_start DISABLE;","displayNoNewLineWarning":false,"position":15,"left":455,"right":461},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":462,"text":" REINDEX INDEX concur_reindex_ind;","html":" REINDEX INDEX concur_reindex_ind;","displayNoNewLineWarning":false,"position":16,"left":456,"right":462},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":463,"text":" REINDEX INDEX CONCURRENTLY concur_reindex_ind;","html":" REINDEX INDEX CONCURRENTLY concur_reindex_ind;","displayNoNewLineWarning":false,"position":17,"left":457,"right":463},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":464,"text":"+-- without an index","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e without an index\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":457,"right":464},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":465,"text":"+DROP INDEX concur_reindex_ind;","html":"+\u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eINDEX\u003c/span\u003e concur_reindex_ind;","displayNoNewLineWarning":false,"position":19,"left":457,"right":465},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":466,"text":"+REINDEX TABLE concur_reindex_tab;","html":"+REINDEX TABLE concur_reindex_tab;","displayNoNewLineWarning":false,"position":20,"left":457,"right":466},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":467,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_tab;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_tab;","displayNoNewLineWarning":false,"position":21,"left":457,"right":467},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":468,"text":"+","html":"+","displayNoNewLineWarning":false,"position":22,"left":457,"right":468},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":469,"text":"+-- With a Schema","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e With a Schema\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":457,"right":469},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":470,"text":"+CREATE SCHEMA concur_reindex_schema;","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eSCHEMA\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_schema\u003c/span\u003e;","displayNoNewLineWarning":false,"position":24,"left":457,"right":470},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":471,"text":"+-- No indexes","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e No indexes\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":457,"right":471},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":472,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":26,"left":457,"right":472},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":473,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":27,"left":457,"right":473},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":474,"text":"+CREATE TABLE concur_reindex_schema.tab (a int);","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_schema\u003c/span\u003e.tab (a \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e);","displayNoNewLineWarning":false,"position":28,"left":457,"right":474},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":475,"text":"+CREATE INDEX ind ON concur_reindex_schema.tab (a);","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eINDEX\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eind\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003econcur_reindex_schema\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003etab\u003c/span\u003e (a);","displayNoNewLineWarning":false,"position":29,"left":457,"right":475},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":476,"text":"+-- One index reported","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e One index reported\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":457,"right":476},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":477,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":31,"left":457,"right":477},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":478,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":32,"left":457,"right":478},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":479,"text":"+-- One table on schema but no indexes","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e One table on schema but no indexes\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":457,"right":479},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":480,"text":"+DROP INDEX concur_reindex_schema.ind;","html":"+\u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eINDEX\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003econcur_reindex_schema\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eind\u003c/span\u003e;","displayNoNewLineWarning":false,"position":34,"left":457,"right":480},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":481,"text":"+REINDEX SCHEMA concur_reindex_schema;","html":"+REINDEX SCHEMA concur_reindex_schema;","displayNoNewLineWarning":false,"position":35,"left":457,"right":481},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":482,"text":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","html":"+REINDEX SCHEMA CONCURRENTLY concur_reindex_schema;","displayNoNewLineWarning":false,"position":36,"left":457,"right":482},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":483,"text":"+DROP SCHEMA concur_reindex_schema CASCADE;","html":"+\u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eSCHEMA\u003c/span\u003e concur_reindex_schema CASCADE;","displayNoNewLineWarning":false,"position":37,"left":457,"right":483},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":484,"text":"+","html":"+","displayNoNewLineWarning":false,"position":38,"left":457,"right":484},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":485,"text":"+-- With a partitioned table, and nothing else.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e With a partitioned table, and nothing else.\u003c/span\u003e","displayNoNewLineWarning":false,"position":39,"left":457,"right":485},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":486,"text":"+CREATE TABLE concur_reindex_part (id int) PARTITION BY RANGE (id);","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_part\u003c/span\u003e (id \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e) PARTITION BY RANGE (id);","displayNoNewLineWarning":false,"position":40,"left":457,"right":486},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":487,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":41,"left":457,"right":487},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":488,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":42,"left":457,"right":488},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":489,"text":"+-- Partition that would be reindexed, still nothing.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Partition that would be reindexed, still nothing.\u003c/span\u003e","displayNoNewLineWarning":false,"position":43,"left":457,"right":489},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":490,"text":"+CREATE TABLE concur_reindex_child PARTITION OF concur_reindex_part","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_child\u003c/span\u003e PARTITION OF concur_reindex_part","displayNoNewLineWarning":false,"position":44,"left":457,"right":490},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":491,"text":"+ FOR VALUES FROM (0) TO (10);","html":"+ FOR \u003cspan class=\"pl-k\"\u003eVALUES\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFROM\u003c/span\u003e (\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e) TO (\u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e);","displayNoNewLineWarning":false,"position":45,"left":457,"right":491},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":492,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":46,"left":457,"right":492},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":493,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":47,"left":457,"right":493},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":494,"text":"+-- Now add some indexes.","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Now add some indexes.\u003c/span\u003e","displayNoNewLineWarning":false,"position":48,"left":457,"right":494},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":495,"text":"+CREATE INDEX concur_reindex_partidx ON concur_reindex_part (id);","html":"+\u003cspan class=\"pl-k\"\u003eCREATE\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eINDEX\u003c/span\u003e \u003cspan class=\"pl-en\"\u003econcur_reindex_partidx\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eON\u003c/span\u003e concur_reindex_part (id);","displayNoNewLineWarning":false,"position":49,"left":457,"right":495},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":496,"text":"+REINDEX INDEX concur_reindex_partidx;","html":"+REINDEX INDEX concur_reindex_partidx;","displayNoNewLineWarning":false,"position":50,"left":457,"right":496},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":497,"text":"+REINDEX INDEX CONCURRENTLY concur_reindex_partidx;","html":"+REINDEX INDEX CONCURRENTLY concur_reindex_partidx;","displayNoNewLineWarning":false,"position":51,"left":457,"right":497},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":498,"text":"+REINDEX TABLE concur_reindex_part;","html":"+REINDEX TABLE concur_reindex_part;","displayNoNewLineWarning":false,"position":52,"left":457,"right":498},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":499,"text":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","html":"+REINDEX TABLE CONCURRENTLY concur_reindex_part;","displayNoNewLineWarning":false,"position":53,"left":457,"right":499},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":500,"text":"+DROP TABLE concur_reindex_part;","html":"+\u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e concur_reindex_part;","displayNoNewLineWarning":false,"position":54,"left":457,"right":500},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":501,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":55,"left":458,"right":501},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":502,"text":" -- Clean up","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e Clean up\u003c/span\u003e","displayNoNewLineWarning":false,"position":56,"left":459,"right":502},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":503,"text":" DROP EVENT TRIGGER regress_reindex_start;","html":" DROP EVENT TRIGGER regress_reindex_start;","displayNoNewLineWarning":false,"position":57,"left":460,"right":503},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":504,"text":" DROP EVENT TRIGGER regress_reindex_end;","html":" DROP EVENT TRIGGER regress_reindex_end;","displayNoNewLineWarning":false,"position":58,"left":461,"right":504},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":505,"text":"+DROP EVENT TRIGGER regress_reindex_end_snap;","html":"+DROP EVENT TRIGGER regress_reindex_end_snap;","displayNoNewLineWarning":false,"position":59,"left":461,"right":505},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":506,"text":" DROP FUNCTION reindex_end_command();","html":" \u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e reindex_end_command();","displayNoNewLineWarning":false,"position":60,"left":462,"right":506},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":507,"text":"+DROP FUNCTION reindex_end_command_snap();","html":"+\u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e reindex_end_command_snap();","displayNoNewLineWarning":false,"position":61,"left":462,"right":507},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":508,"text":" DROP FUNCTION reindex_start_command();","html":" \u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eFUNCTION\u003c/span\u003e reindex_start_command();","displayNoNewLineWarning":false,"position":62,"left":463,"right":508},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":509,"text":" DROP TABLE concur_reindex_tab;","html":" \u003cspan class=\"pl-k\"\u003eDROP\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eTABLE\u003c/span\u003e concur_reindex_tab;","displayNoNewLineWarning":false,"position":63,"left":464,"right":509},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":510,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":64,"left":465,"right":510}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":587,"linesChanged":45,"newTreeEntry":{"lineCount":587,"path":"src/test/regress/sql/event_trigger.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/sql/event_trigger.sql","mode":100644},"linesAdded":45,"linesDeleted":0,"path":"src/test/regress/sql/event_trigger.sql","pathDigest":"55dc555a7794a6fe4e2ebd5adae0b9c3ae70b697551c15b139768db7f3d613c6","status":"MODIFIED","truncatedReason":null,"oldOid":"c2a465b2c94fb44211c350f73b5a11978d3b4536","newOid":"c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","copilotChatReference":null,"deletedSha":"c2a465b2c94fb44211c350f73b5a11978d3b4536","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84","fileTreeExpanded":true,"headerInfo":{"additions":99,"deletions":3,"filesChanged":3,"filesChangedString":"3"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":3,"truncated":false,"byteCount":6835,"lineShownCount":155},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"MQi2TFkY59cQd7DSDiBaejCMvCcXkWt3LaBabpvUqtqOTO3OwyglWvS6lqhgOhKciUws9O9MVY4PEHEjmfDItA"},"/users/diffview?diff=unified":{"post":"9ck592LMvc3J35FHzfAcjB84SZMChUlOPYxG6Y9Xb_xKjWJ1-Px_QC0Stz2j6lRqpvjZQPpYd7cfPG2kjXMNkg"},"/notifications/thread":{"post":"jpNN8tJXT8YWzlggHUlHVZg-GpNOkCv-5qOw7CGqj6k2TtfWIwe5fa5_qWU4Aj5tN-UddLtIBMqjk4SeR5GSow"}}},"title":"Fix assertion failure with REINDEX and event triggers · postgres/postgres@c426f7c","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}
Fix assertion failure with REINDEX and event triggers
A REINDEX CONCURRENTLY run on a table with no indexes would always pop
the topmost snapshot from the active snapshot stack, making the snapshot
handling inconsistent between the multiple-relation and single-relation
cases. This commit slightly changes the snapshot stack handling so as a
snapshot is popped only ReindexMultipleInternal() in this case after a
relation has been reindexed, fixing a problem where an event trigger
function may need a snapshot but does not have one. This also keeps the
places where PopActiveSnapshot() is called closer to each other.
While on it, this expands the existing tests to cover all the cases that
could be faced with REINDEX commands and such event triggers, for one or
more relations, with or without indexes.
This behavior is inconsistent since 5dc92b8, but we've never had a
need for an active snapshot at the end of a REINDEX until now.
Thanks also to Jian He for the input.
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/cb538743-484c-eb6a-a8c5-359980cd3a17@gmail.com
0 commit comments