theory/pgtap

Revamp functions to use DEFAULT values

RekGRpth opened this issue · 11 comments

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

treated as

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

but

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

treated right!

also col_has_default has same bug

also col_hasnt_default has same bug

also col_default_is has same bug

also has_pk has same bug

also hasnt_pk has same bug

also col_is_pk has same bug

also col_isnt_pk has same bug

also has_unique has same bug

also col_is_unique has same bug

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.