Open SamGrisey opened 3 hours ago
@SamGrisey Hello! Thank you very much for the issue. I’ll look into it today.
Ignore what I said above, the error seems to be with empty array values, not my old db instance. Example SQL:
CREATE TABLE IF NOT EXISTS test (
id serial NOT NULL PRIMARY KEY,
locked_fields text[] NOT NULL DEFAULT array[]::text[]
);
INSERT INTO test VALUES(1, '{"abc"}');
INSERT INTO test(id) VALUES(2);
INSERT INTO test VALUES(3, ARRAY[]::TEXT[]);
SELECTING all within psql terminal yields:
SELECT * FROM test;
id | locked_fields
----+---------------
1 | {abc}
2 | {}
3 | {}
(3 rows)
so as you can see, all rows have arrays (neither are NULL), yet id 2 was auto-populated by its default value and 3 was explicitly set empty.
now on psqlpy, running SELECT * FROM test WHERE id = 1;
works fine, but running SELECT * FROM test WHERE id = 2;
and SELECT * FROM test WHERE id = 3;
will cause that crash.
@SamGrisey Okay, I know what’s the problem here, I’ll fix it as soon as I come to my laptop
@SamGrisey Please check new version - https://github.com/psqlpy-python/psqlpy/releases/tag/0.7.11
It would seem that array types are not being recognized properly. If I create a simple table:
then add some rows and do a
the
return res.result()
line causes a crash:The rust code looks like its expecting a postgres type "TEXT ARRAY" but the type is really "text[]". Even if I declare the table column as having type "TEXT ARRAY" instead of "TEXT[]", \d still reports it as "text[]"
EDIT: It actually works fine with the same simple table on a fresh database, there must be something different with the existing database... but the array column does indeed crash with that error with fetched on the old database, just no idea why now...