pgtap icon indicating copy to clipboard operation
pgtap copied to clipboard

Revamp functions to use DEFAULT values

Open RekGRpth opened this issue 3 years ago • 11 comments

SELECT has_column('schema'::name, 'table'::name, 'column'::name);

treated as

SELECT has_column('schema'::name, 'table'::name, 'column'::text);

RekGRpth avatar Nov 11 '21 11:11 RekGRpth

but

SELECT col_not_null('schema'::name, 'table'::name, 'column'::name);

treated right!

RekGRpth avatar Nov 11 '21 11:11 RekGRpth

also col_has_default has same bug

RekGRpth avatar Nov 12 '21 03:11 RekGRpth

also col_hasnt_default has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also col_default_is has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also has_pk has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also hasnt_pk has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also col_is_pk has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also col_isnt_pk has same bug

RekGRpth avatar Nov 12 '21 08:11 RekGRpth

also has_unique has same bug

RekGRpth avatar Nov 12 '21 09:11 RekGRpth

also col_is_unique has same bug

RekGRpth avatar Nov 12 '21 09:11 RekGRpth

col_not_null()'s use of description TEXT DEFAULT NULL as the last argument might be the reason it works better. Now that we've dropped support for v9.0 and earlier, it might make sense to refactor many of the older functions to use that syntax, as it simplifies the code and might well address resolution issues such as @RekGRpth mentions here. Lotta work, though, and not gonna happen before we ship 1.2.0, but I would certainly welcome a PR making such a change.

theory avatar Nov 14 '21 22:11 theory