Error when updating the foreign key for table \"public\".\"jbid_io_attr\", err: ERROR #22P02 invalid input syntax for type bigint: \"\"
janpio opened this issue · comments
mock-windows-amd64-v2.4.exe database -a localhost -w foo -f -v -d exo
...
time="2020-03-08 16:47:56" level=debug msg="Extracting the foreign violations for table \"public\".\"gamification_rule\" and column gamification_domain" file="sql.go:517"
Fixing FOREIGN KEYS violation 19% [========> ] (16/81) [10s:42s]time="2020-03-08 16:47:56" level=debug msg="Fixing the Primary / Unique Key" file="constraintsRestore.go:99"
time="2020-03-08 16:47:56" level=debug msg="Checking / Fixing FOREIGN KEY Violation table: \"public\".\"jbid_io\", column: realm, reference: jbid_realm(id)" file="constraintsRestore.go:109"
time="2020-03-08 16:47:56" level=debug msg="Extracting the foreign violations for table \"public\".\"jbid_io\" and column jbid_realm" file="sql.go:517"
Fixing FOREIGN KEYS violation 20% [=========> ] (17/81) [11s:41s]time="2020-03-08 16:47:57" level=debug msg="Fixing the Primary / Unique Key" file="constraintsRestore.go:99"
time="2020-03-08 16:47:57" level=debug msg="Checking / Fixing FOREIGN KEY Violation table: \"public\".\"jbid_io\", column: identity_type, reference: jbid_io_type(id)" file="constraintsRestore.go:109"
time="2020-03-08 16:47:57" level=debug msg="Extracting the foreign violations for table \"public\".\"jbid_io\" and column jbid_io_type" file="sql.go:517"
Fixing FOREIGN KEYS violation 22% [==========> ] (18/81) [11s:40s]time="2020-03-08 16:47:57" level=debug msg="Fixing the Primary / Unique Key" file="constraintsRestore.go:99"
time="2020-03-08 16:47:57" level=debug msg="Checking / Fixing FOREIGN KEY Violation table: \"public\".\"jbid_io_attr\", column: identity_object_id, reference: jbid_io(id)" file="constraintsRestore.go:109"
time="2020-03-08 16:47:57" level=debug msg="Extracting the foreign violations for table \"public\".\"jbid_io_attr\" and column jbid_io" file="sql.go:517"
Fixing FOREIGN KEYS violation 23% [==========> ] (19/81) [12s:38s]time="2020-03-08 16:47:58" level=debug msg="Fixing the Primary / Unique Key" file="constraintsRestore.go:99"
time="2020-03-08 16:47:58" level=debug msg="Checking / Fixing FOREIGN KEY Violation table: \"public\".\"jbid_io_attr\", column: bin_value_id, reference: jbid_attr_bin_value(bin_value_id)" file="constraintsRestore.go:109"
time="2020-03-08 16:47:58" level=debug msg="Extracting the foreign violations for table \"public\".\"jbid_io_attr\" and column jbid_attr_bin_value" file="sql.go:517"
time="2020-03-08 16:47:59" level=debug msg="Extracting the foreign violations for table \"public\".\"jbid_io_attr\" and column jbid_attr_bin_value" file="sql.go:517"
time="2020-03-08 16:47:59" level=debug msg="query: \nUPDATE \"public\".\"jbid_io_attr\" \nSET bin_value_id = \n ( \n SELECT bin_value_id \n FROM jbid_attr_bin_value offset floor(random()*0) limit 1) \nWHERE bin_value_id = ''\n" file="sql.go:549"
time="2020-03-08 16:47:59" level=fatal msg="Error when updating the foreign key for table \"public\".\"jbid_io_attr\", err: ERROR #22P02 invalid input syntax for type bigint: \"\"" file="sql.go:550"
Schema is https://github.com/prisma/database-schema-examples/blob/master/postgres/exo/schema.sql
Following through the code, it seems that whichRow
is empty here:
https://github.com/pivotal-gss/mock-data/blob/ac23cf13044b2d697a9fa411cc6c18132c6002db/sql.go#L545
whichRow
is filled via v.Row
:
https://github.com/pivotal-gss/mock-data/blob/ac23cf13044b2d697a9fa411cc6c18132c6002db/constraintsRestore.go#L120-L122
How it should be filled in the function I unfortunately do not understand:
https://github.com/pivotal-gss/mock-data/blob/ac23cf13044b2d697a9fa411cc6c18132c6002db/sql.go#L516-L533
Any pointers?
Yup mock-data would not have added any rows on the table jbid_attr_bin_value
CREATE TABLE public.jbid_attr_bin_value (
bin_value_id bigint NOT NULL,
value oid
);
since it contains a column oid
that we don't support. You should have received a warning like this
https://github.com/pivotal-gss/mock-data/blob/master/worker.go#L183
on the screen, that we skipped the table. I believe we should support it since its a postgres inbuilt datatype, will add this to the list
Indeed:
...
time="2020-03-08 23:52:56" level=debug msg="Table \"public\".\"jbid_attr_bin_value\" skipped, since the column value, had unknown data type oid: unsupported datatypes found: oid" file="worker.go:138"
...
time="2020-03-08 23:53:01" level=debug msg="Table \"public\".\"jbid_creden_bin_value\" skipped, since the column value, had unknown data type oid: unsupported datatypes found: oid" file="worker.go:138"
...
With the many tables, and verbose output, it was super easy to miss.
Fixed added support for OID, will be available on the next release