Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ alter_action
/ ALTER_COLUMN_DATA_TYPE
/ ALTER_COLUMN_DEFAULT
/ ALTER_COLUMN_NOT_NULL
/ ALTER_REPLICA_IDENTITY

ALTER_ADD_COLUMN
= KW_ADD __
Expand Down Expand Up @@ -2162,6 +2163,25 @@ ALTER_COLUMN_NOT_NULL
type: 'alter',
}
}

ALTER_REPLICA_IDENTITY
= 'REPLICA'i __ 'IDENTITY'i __ n:('DEFAULT'i / 'FULL'i / 'NOTHING'i) {
/* => {
action: 'replica';
keyword?: 'identity';
resource: 'replica_identity';
type: 'alter';
replica_identity: 'default' | 'full' | 'nothing';
}
*/
return {
action: 'replica',
keyword: 'identity',
resource: 'replica_identity',
replica_identity: n,
type: 'alter',
}
}
create_index_definition
= kc:(KW_INDEX / KW_KEY) __
c:column? __
Expand Down
7 changes: 7 additions & 0 deletions test/postgres.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,13 @@ describe('Postgres', () => {
'ALTER TABLE "configuration" ADD CONSTRAINT "configuration_pk" PRIMARY KEY ("something", "something_else", "something_something_else")',
]
},
{
title: 'alter replica identity',
sql: [
'ALTER TABLE "table_name" REPLICA IDENTITY FULL;',
'ALTER TABLE "table_name" REPLICA IDENTITY FULL',
]
},
]
function neatlyNestTestedSQL(sqlList){
sqlList.forEach(sqlInfo => {
Expand Down