Skip to content

Commit

Permalink
[11.x] Fix retrieving generated columns on legacy PostgreSQL (#50834)
Browse files Browse the repository at this point in the history
* fix retrieving generated column on pgsql < 12

* flip the condition
  • Loading branch information
hafezdivandari authored Mar 29, 2024
1 parent 21d32cc commit fd4edf4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function compileColumns($schema, $table)
.'(select tc.collcollate from pg_catalog.pg_collation tc where tc.oid = a.attcollation) as collation, '
.'not a.attnotnull as nullable, '
.'(select pg_get_expr(adbin, adrelid) from pg_attrdef where c.oid = pg_attrdef.adrelid and pg_attrdef.adnum = a.attnum) as default, '
.'a.attgenerated as generated, '
.(version_compare($this->connection?->getServerVersion(), '12.0', '<') ? "'' as generated, " : 'a.attgenerated as generated, ')
.'col_description(c.oid, a.attnum) as comment '
.'from pg_attribute a, pg_class c, pg_type t, pg_namespace n '
.'where c.relname = %s and n.nspname = %s and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and n.oid = c.relnamespace '
Expand Down

0 comments on commit fd4edf4

Please sign in to comment.