mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-01 16:28:46 +00:00
fix: correct PostgreSQL numeric_scale formula and add index SQL test coverage
The numeric_scale extraction used (& 2047) - 1024 which produces negative values; fixed to & 65535. Added 12 tests for index SQL generation: INCLUDE, USING, WHERE, COMMENT ON INDEX, type prefix, and combined scenarios.
This commit is contained in:
@@ -168,7 +168,7 @@ pub async fn get_columns(
|
||||
CASE WHEN t.typname = 'numeric' AND a.atttypmod > 0 \
|
||||
THEN ((a.atttypmod - 4) >> 16) & 65535 ELSE NULL END AS numeric_precision, \
|
||||
CASE WHEN t.typname = 'numeric' AND a.atttypmod > 0 \
|
||||
THEN ((a.atttypmod - 4) & 2047) - 1024 ELSE NULL END AS numeric_scale, \
|
||||
THEN (a.atttypmod - 4) & 65535 ELSE NULL END AS numeric_scale, \
|
||||
CASE WHEN t.typname IN ('varchar', 'bpchar') AND a.atttypmod > 0 \
|
||||
THEN a.atttypmod - 4 ELSE NULL END AS character_maximum_length \
|
||||
FROM pg_attribute a \
|
||||
|
||||
Reference in New Issue
Block a user