ablog

不器用で落着きのない技術者のメモ

Redshift における aws_teradata_ext の挙動を確認したメモ

Redshift における AWS Schema Conversion Tool(SCT) の extension pack の aws_teradata_ext の挙動を確認したメモ。

sample=# select aws_teradata_ext.TRUNC('20220818', 'RM');
   trunc
------------
 2022-08-01
(1 row)

sample=# select aws_teradata_ext.TRUNC('20220818'::date, 'RM');
   trunc
------------
 2022-08-01
(1 row)

sample=# select aws_teradata_ext.TRUNC('2022-08-18'::date, 'RM');
   trunc
------------
 2022-08-01
(1 row)
sample=# select '20220526'::date - (90::NUMERIC || ' day')::interval;
      ?column?
---------------------
 2022-02-25 00:00:00
(1 row)

sample=# select '20220526' - (90::NUMERIC || ' day')::interval;
     ?column?
-------------------
 143 days 22:02:06
(1 row)

sample=# select '2022-05-26' - (90::NUMERIC || ' day')::interval;
ERROR:  invalid input syntax for type interval: "2022-05-26"
sample=# select '2022-05-26'::date - (90::NUMERIC || ' day')::interval;
      ?column?
---------------------
 2022-02-25 00:00:00
(1 row)
sample=# select '20220518'::date - 7;
  ?column?
------------
 2022-05-11
(1 row)

sample=# select '20220518' - 7;
  ?column?
------------
 2022-05-11
(1 row)