mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-08 07:16:58 +02:00
Accept quoted namestrings as target type names for cast rules.
This allows passing "double precision" rather than float8, for example. Fix #650.
This commit is contained in:
parent
a28e9b3556
commit
a9afddf8ed
@ -47,9 +47,10 @@
|
|||||||
,@(when d-s-p (list :default default))
|
,@(when d-s-p (list :default default))
|
||||||
,@(when ai-s-p (list :auto-increment auto-increment))))))
|
,@(when ai-s-p (list :auto-increment auto-increment))))))
|
||||||
|
|
||||||
(defrule cast-type-name (and (alpha-char-p character)
|
(defrule cast-type-name (or double-quoted-namestring
|
||||||
|
(and (alpha-char-p character)
|
||||||
(* (or (alpha-char-p character)
|
(* (or (alpha-char-p character)
|
||||||
(digit-char-p character))))
|
(digit-char-p character)))))
|
||||||
(:text t))
|
(:text t))
|
||||||
|
|
||||||
(defrule cast-to-type (and kw-to cast-type-name ignore-whitespace)
|
(defrule cast-to-type (and kw-to cast-type-name ignore-whitespace)
|
||||||
|
@ -13,7 +13,11 @@ load database
|
|||||||
to text drop not null using empty-string-to-null,
|
to text drop not null using empty-string-to-null,
|
||||||
|
|
||||||
column base64.id to uuid drop typemod,
|
column base64.id to uuid drop typemod,
|
||||||
column base64.data to jsonb using base64-decode
|
column base64.data to jsonb using base64-decode,
|
||||||
|
|
||||||
|
type decimal
|
||||||
|
when (and (= 18 precision) (= 6 scale))
|
||||||
|
to "double precision" drop typemod
|
||||||
|
|
||||||
BEFORE LOAD DO $$ create schema if not exists mysql; $$;
|
BEFORE LOAD DO $$ create schema if not exists mysql; $$;
|
||||||
|
|
||||||
|
8
test/mysql/my.sql
vendored
8
test/mysql/my.sql
vendored
@ -33,6 +33,14 @@ insert into `geom`(`p`, `l`)
|
|||||||
values (ST_GeomFromText('POINT(1 1)'),
|
values (ST_GeomFromText('POINT(1 1)'),
|
||||||
ST_GeomFromText('LINESTRING(-87.87342467651445 45.79684462673078,-87.87170806274479 45.802110434248966,-87.84492888794016 45.79732335706963,-87.84046569213925 45.79349339919981,-87.83703246459994 45.795887153715135,-87.82261290893646 45.7954084110377,-87.82261290893646 45.781523084289475,-87.82879271850615 45.7796075953549,-87.84115233764729 45.779128712838755,-87.85110869751074 45.78008647375808,-87.83737578735439 45.782001946240946,-87.84527221069374 45.78343850741725)'));
|
ST_GeomFromText('LINESTRING(-87.87342467651445 45.79684462673078,-87.87170806274479 45.802110434248966,-87.84492888794016 45.79732335706963,-87.84046569213925 45.79349339919981,-87.83703246459994 45.795887153715135,-87.82261290893646 45.7954084110377,-87.82261290893646 45.781523084289475,-87.82879271850615 45.7796075953549,-87.84115233764729 45.779128712838755,-87.85110869751074 45.78008647375808,-87.83737578735439 45.782001946240946,-87.84527221069374 45.78343850741725)'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* https://github.com/dimitri/pgloader/issues/650
|
||||||
|
*/
|
||||||
|
CREATE TABLE propertydecimal (
|
||||||
|
ID decimal(18,0) NOT NULL,
|
||||||
|
propertyvalue decimal(18,6) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table `base64`
|
create table `base64`
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user