pgloader
pgloader copied to clipboard
Fix "reset sequences" crash on tables with case sensitive column names
On case sensitive migrations (i.e. with "quote identifiers"), reset sequences fail with the following error.
Database error 42703: column ""<columnName>"" of relation "<table>" does not exist
This is due to invalid parameters being passed to pg_get_serial_sequence function introduced in e32066d35a03df3b386189d5c4e9dcd11805ee03
for example, on a mysql table with following definition
CREATE TABLE botLog(
`logID` bigint(20) NOT NULL AUTO_INCREMENT,
`message` varchar(255),
PRIMARY KEY (`logID`)
);
SELECT pg_get_serial_sequence(quote_ident('public') || '.' || quote_ident('botLog'), quote_ident('logID'));
ERROR: column ""logID"" of relation "botLog" does not exist
throws the same error, but the following works
SELECT pg_get_serial_sequence(quote_ident('public') || '.' || quote_ident('botLog'), 'logID');
pg_get_serial_sequence
---------------------------
public."botLog_logID_seq"
ref: https://github.com/dimitri/pgloader/issues/425
Is this something that can be merged in soon? facing this issue