mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Adapt to CURRENT_TIMESTAMP(x) default values.
We target CURRENT_TIMESTAMP as the PostgreSQL default value for columns
when it was different before on the grounds that the type casting in
PostgreSQL is doing the job, as in the following example:
pgloader# create table test_ts(ts timestamptz(6) not null default CURRENT_TIMESTAMP);
CREATE TABLE
pgloader# insert into test_ts VALUES(DEFAULT);
INSERT 0 1
pgloader# table test_ts;
ts
-------------------------------
2016-02-24 18:32:22.820477+01
(1 row)
pgloader# drop table test_ts;
DROP TABLE
pgloader# create table test_ts(ts timestamptz(0) not null default CURRENT_TIMESTAMP);
CREATE TABLE
pgloader# insert into test_ts VALUES(DEFAULT);
INSERT 0 1
pgloader# table test_ts;
ts
------------------------
2016-02-24 18:32:44+01
(1 row)
Fix #341.
This commit is contained in:
parent
40c1581794
commit
eaa5807244
@ -9,8 +9,10 @@
|
||||
(cond
|
||||
((null default) "NULL")
|
||||
((and (stringp default) (string= "NULL" default)) default)
|
||||
((and (stringp default) (string= "CURRENT_TIMESTAMP" default)) default)
|
||||
((and (stringp default) (string= "CURRENT TIMESTAMP" default))
|
||||
((and (stringp default)
|
||||
;; address CURRENT_TIMESTAMP(6) and other spellings
|
||||
(or (uiop:string-prefix-p "CURRENT_TIMESTAMP" default)
|
||||
(string= "CURRENT TIMESTAMP" default)))
|
||||
"CURRENT_TIMESTAMP")
|
||||
((and (stringp default) (string= "newsequentialid()" default))
|
||||
"uuid_generate_v1()")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user