PostgreSQL: grid edits cast uuid column to ::text in WHERE clause

scottnz's profile image scottnz posted 1 month ago in General Permalink

When I edit a row in the data grid on a PostgreSQL table with a uuid primary key, HeidiSQL generates the UPDATE like this:

UPDATE "public"."user" SET "email"=NULL WHERE "id"::text='abca3c35-9ed8-4e2b-864a-2d85f7fbcdc5';

The cast on the column ("id"::text) means PostgreSQL can't use the index on the uuid primary key, so every grid edit does a sequential scan. On large tables this makes editing noticeably slow. I don't remember this happening in older versions.

Is there a setting to change this behavior?

HeidiSQL version: 12.20.0.7320

PostgreSQL version: 14.20.0

Thanks

ansgar's profile image ansgar posted 1 month ago Permalink

Yes that was me! :)

That cast to ::text solved issue #272 for displaying pgsql array columns in the grids.

But I already made an exception for integers and floats, as of issue #2499.

Reading your comment I would now add a nother exception for UUID columns. Though that starts to render my fix for issue #272 more useless, as the UUID type may also be used as array type, right?

scottnz's profile image scottnz posted 2 weeks ago Permalink

Thanks ansgar. Yes I imagine it would make that fix less useful and I can't really think of a solution right now. In the meantime I have been writing the update statements manually when there are a few rows to edit at once.

Please login to leave a reply, or register at first.