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
Copy file name to clipboardExpand all lines: src/Database/Drivers/PgSqlDriver.php
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,16 @@ public function getColumns(string $table): array
134
134
a.attname::varchar AS name,
135
135
c.relname::varchar AS table,
136
136
upper(t.typname) AS "nativeType",
137
-
CASE WHEN a.atttypmod = -1 THEN NULL ELSE a.atttypmod -4 END AS size,
137
+
CASE
138
+
WHEN a.atttypid IN (1700, 1231) THEN ((a.atttypmod - 4) >> 16) & 65535 -- precision for numeric/decimal
139
+
WHEN a.atttypmod > 0 THEN a.atttypmod - 4 -- length for varchar etc.
140
+
WHEN t.typlen > 0 THEN t.typlen -- length for fixed-length types
141
+
ELSE NULL
142
+
END AS length,
143
+
CASE
144
+
WHEN a.atttypid IN (1700, 1231) THEN (a.atttypmod - 4) & 65535
145
+
ELSE null
146
+
END AS scale,
138
147
NOT (a.attnotnull OR t.typtype = 'd' AND t.typnotnull) AS nullable,
139
148
pg_catalog.pg_get_expr(ad.adbin, 'pg_catalog.pg_attrdef'::regclass)::varchar AS default,
140
149
coalesce(co.contype = 'p' AND (seq.relname IS NOT NULL OR strpos(pg_catalog.pg_get_expr(ad.adbin, ad.adrelid), 'nextval') = 1), FALSE) AS "autoIncrement",
0 commit comments