mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Fix "drop default" casting rule.
The previous coding would discard any work done at the apply-casting-rules step when adding source specific smarts about handling default, because of what looks like negligence and bad tests. A test case scenario exists but was not exercized :( Fix that by defaulting the default value to the one given back at the apply-casting-rules stage, where we apply the "drop default" clause.
This commit is contained in:
parent
d74c9625a3
commit
355aedfd72
@ -147,6 +147,6 @@
|
||||
(string= "newsequentialid()" default)))
|
||||
:generate-uuid)
|
||||
|
||||
(t default)))
|
||||
(t (column-default pgcol))))
|
||||
pgcol)))
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@
|
||||
(or (uiop:string-prefix-p "CURRENT_TIMESTAMP" default)
|
||||
(string= "CURRENT TIMESTAMP" default)))
|
||||
:current-timestamp)
|
||||
(t default)))
|
||||
(t (column-default pgcol))))
|
||||
|
||||
;; extra user-defined data types
|
||||
(when (or (string-equal "set" dtype)
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
(or (uiop:string-prefix-p "CURRENT_TIMESTAMP" default)
|
||||
(string= "CURRENT TIMESTAMP" default)))
|
||||
:current-timestamp)
|
||||
(t default)))
|
||||
(t (column-default pgcol))))
|
||||
|
||||
pgcol)))
|
||||
|
||||
|
||||
@ -4,16 +4,15 @@ load database
|
||||
|
||||
-- with include drop, create tables, create indexes, reset sequences
|
||||
|
||||
-- excluding table names like 'appointments'
|
||||
|
||||
before load do
|
||||
$$ drop schema if exists sqlite cascade; $$,
|
||||
$$ create schema if not exists sqlite; $$
|
||||
|
||||
cast column character.f1 to text drop typemod,
|
||||
column appointments.time
|
||||
to timestamptz drop default
|
||||
using sqlite-timestamp-to-timestamp,
|
||||
type intege to integer
|
||||
column appointments.time to timestamptz drop default,
|
||||
type intege to integer,
|
||||
type character to varchar keep typemod
|
||||
|
||||
set work_mem to '16MB', maintenance_work_mem to '512 MB', search_path to 'sqlite';
|
||||
set work_mem to '16MB',
|
||||
maintenance_work_mem to '512 MB',
|
||||
search_path to 'sqlite';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user