mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Fix auto_increment support in cast rules.
This fixes #141 again when users are forcing MySQL bigint(20) into PostgreSQL bigint types so that foreign keys can be installed. To this effect, as cast rule such as the following is needing: cast type bigint when (= 20 precision) to bigint drop typemod Before this patch, this user provided cast rule would also match against MySQL types "with extra auto_increment", and it should not. If you're having the problem that this patch fixes on an older pgloader that you can't or won't upgrade, consider the following user provided set of cast rules to achieve the same effect: cast type bigint with extra auto_increment to bigserial drop typemod, type bigint when (= 20 precision) to bigint drop typemod
This commit is contained in:
parent
c108b85290
commit
765bbb70aa
@ -47,7 +47,7 @@
|
||||
((:typemod typemod-expr) nil tm-s-p)
|
||||
((:default rule-source-default) nil d-s-p)
|
||||
((:not-null rule-source-not-null) nil n-s-p)
|
||||
((:auto-increment rule-source-auto-increment) nil ai-s-p)
|
||||
((:auto-increment rule-source-auto-increment))
|
||||
&allow-other-keys)
|
||||
rule-source
|
||||
(destructuring-bind (&key table-name
|
||||
@ -69,7 +69,11 @@
|
||||
(or (null tm-s-p) (typemod-expr-matches-p typemod-expr typemod))
|
||||
(or (null d-s-p) (string= default rule-source-default))
|
||||
(or (null n-s-p) (eq not-null rule-source-not-null))
|
||||
(or (null ai-s-p) (eq auto-increment rule-source-auto-increment)))
|
||||
|
||||
;; current RULE only matches SOURCE when both have an
|
||||
;; auto_increment property, or none have it.
|
||||
(or (and auto-increment rule-source-auto-increment)
|
||||
(and (not auto-increment) (not rule-source-auto-increment))))
|
||||
(list :using using :target rule-target))))))
|
||||
|
||||
(defun make-pgsql-type (source target using)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user