Change CURRENT_TIMESTAMP parameter for col_default_is
It turns out i have been **years** doing this wrong: you are supposed to pass that value as a text, like 'CURRENT_TIMESTAMP', not like the keyword so that it returns the current timestamp as a timestamptz. However, i have been doing it wrong because of a bug in previous versions of pgTAP[0], that did not take into account keywords such as CURRENT_TIMESTAMP or CURRENT_DATE and was comparing their actual values, not the names, therefore i thought that i misread the documentation. Only now have discovered this because Debian 12 upgraded pgTAP version to 1.2.0. [0]: https://github.com/theory/pgtap/issues/244
This commit is contained in:
parent
73682462da
commit
010e174de7
|
@ -123,7 +123,7 @@ select has_column('company', 'created_at');
|
|||
select col_type_is('company', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('company', 'created_at');
|
||||
select col_has_default('company', 'created_at');
|
||||
select col_default_is('company', 'created_at', current_timestamp);
|
||||
select col_default_is('company', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
set client_min_messages to warning;
|
||||
|
|
|
@ -110,7 +110,7 @@ select has_column('contact', 'created_at');
|
|||
select col_type_is('contact', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('contact', 'created_at');
|
||||
select col_has_default('contact', 'created_at');
|
||||
select col_default_is('contact', 'created_at', current_timestamp);
|
||||
select col_default_is('contact', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
set client_min_messages to warning;
|
||||
truncate contact cascade;
|
||||
|
|
|
@ -82,7 +82,7 @@ select has_column('expense', 'created_at');
|
|||
select col_type_is('expense', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('expense', 'created_at');
|
||||
select col_has_default('expense', 'created_at');
|
||||
select col_default_is('expense', 'created_at', current_timestamp);
|
||||
select col_default_is('expense', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
set client_min_messages to warning;
|
||||
|
|
|
@ -52,7 +52,7 @@ select has_column('invoice', 'invoice_date');
|
|||
select col_type_is('invoice', 'invoice_date', 'date');
|
||||
select col_not_null('invoice', 'invoice_date');
|
||||
select col_has_default('invoice', 'invoice_date');
|
||||
select col_default_is('invoice', 'invoice_date', current_date);
|
||||
select col_default_is('invoice', 'invoice_date', 'CURRENT_DATE');
|
||||
|
||||
select has_column('invoice', 'contact_id');
|
||||
select col_is_fk('invoice', 'contact_id');
|
||||
|
@ -99,7 +99,7 @@ select has_column('invoice', 'created_at');
|
|||
select col_type_is('invoice', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('invoice', 'created_at');
|
||||
select col_has_default('invoice', 'created_at');
|
||||
select col_default_is('invoice', 'created_at', current_timestamp);
|
||||
select col_default_is('invoice', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
set client_min_messages to warning;
|
||||
|
|
|
@ -42,7 +42,7 @@ select has_column('login_attempt', 'attempted_at');
|
|||
select col_type_is('login_attempt', 'attempted_at', 'timestamp with time zone');
|
||||
select col_not_null('login_attempt', 'attempted_at');
|
||||
select col_has_default('login_attempt', 'attempted_at');
|
||||
select col_default_is('login_attempt', 'attempted_at', current_timestamp);
|
||||
select col_default_is('login_attempt', 'attempted_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
select *
|
||||
from finish();
|
||||
|
|
|
@ -68,7 +68,7 @@ select has_column('product', 'created_at');
|
|||
select col_type_is('product', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('product', 'created_at');
|
||||
select col_has_default('product', 'created_at');
|
||||
select col_default_is('product', 'created_at', current_timestamp);
|
||||
select col_default_is('product', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
set client_min_messages to warning;
|
||||
|
|
|
@ -52,7 +52,7 @@ select has_column('quote', 'quote_date');
|
|||
select col_type_is('quote', 'quote_date', 'date');
|
||||
select col_not_null('quote', 'quote_date');
|
||||
select col_has_default('quote', 'quote_date');
|
||||
select col_default_is('quote', 'quote_date', current_date);
|
||||
select col_default_is('quote', 'quote_date', 'CURRENT_DATE');
|
||||
|
||||
select has_column('quote', 'quote_status');
|
||||
select col_is_fk('quote', 'quote_status');
|
||||
|
@ -91,7 +91,7 @@ select has_column('quote', 'created_at');
|
|||
select col_type_is('quote', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('quote', 'created_at');
|
||||
select col_has_default('quote', 'created_at');
|
||||
select col_default_is('quote', 'created_at', current_timestamp);
|
||||
select col_default_is('quote', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
set client_min_messages to warning;
|
||||
|
|
|
@ -68,7 +68,7 @@ select has_column('user', 'created_at');
|
|||
select col_type_is('user', 'created_at', 'timestamp with time zone');
|
||||
select col_not_null('user', 'created_at');
|
||||
select col_has_default('user', 'created_at');
|
||||
select col_default_is('user', 'created_at', current_timestamp);
|
||||
select col_default_is('user', 'created_at', 'CURRENT_TIMESTAMP');
|
||||
|
||||
|
||||
select *
|
||||
|
|
Loading…
Reference in New Issue