Skip to content

Commit

Permalink
sql: fix attidentity for GENERATED BY DEFAULT AS IDENTITY column
Browse files Browse the repository at this point in the history
It should be `d` rather than `b` in this case.

Release note (bug fix): attidentity for `GENERATED BY DEFAULT AS IDENTITY`
column should be `d`.

<what was there before: Previously, ...>
<why it needed to change: This was inadequate because ...>
<what you did about it: To address this, this patch ...>
  • Loading branch information
ZhouXing19 committed Nov 28, 2022
1 parent 1a6e9f8 commit b974aca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ t1 j -1 NULL NULL NU
t1 k 14 NULL NULL NULL false false · ·
t1 l -1 NULL NULL NULL false false · v
t1 m -1 NULL NULL NULL true true a ·
t1 n -1 NULL NULL NULL true true b ·
t1 n -1 NULL NULL NULL true true d ·
t1_pkey p -1 NULL NULL NULL true false · ·
t1_a_key a -1 NULL NULL NULL false false · ·
index_key b -1 NULL NULL NULL false false · ·
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ https://www.postgresql.org/docs/12/catalog-pg-attribute.html`,
if column.IsGeneratedAlwaysAsIdentity() {
generatedAsIdentityType = "a"
} else if column.IsGeneratedByDefaultAsIdentity() {
generatedAsIdentityType = "b"
generatedAsIdentityType = "d"
} else {
return errors.AssertionFailedf(
"column %s is of wrong generated as identity type (neither ALWAYS nor BY DEFAULT)",
Expand Down

0 comments on commit b974aca

Please sign in to comment.