I'm a happy user of flamerobin, but I have a small problem now:
I have a few tables in which GUID's are used as primary keys. For some
reason I am unable to delete rows from these tables with flamerobin
(0.9.3.2091). I can select them and mark them for removal, but after a
commit the rows are still present. I don't have this issue on tables with
integer primary keys. Also writing and executing the delete statement
manually will remove the rows.
Is this a feature or a bug?
I use flamerobin against Firebird 2.5.1.
Script which creates a table that shows the problem:
/********************* ROLES **********************/
Re: Can't delete rows from table wit GUID primary key
On 14.10.2011 11:44, Erik Heemskerk wrote:
> I have a few tables in which GUID's are used as primary keys. For
> some reason I am unable to delete rows from these tables with
> flamerobin (0.9.3.2091).
> Is this a feature or a bug?
A bug. The problem lies with the StringColumnDef class that holds the
string data for tables - it is smart enough to treat character data with
the character set octets in a special way (formatting each byte as a two
digit hexadecimal value), but not smart enough to remember the character
set and apply the reverse conversion when the field value is read back
to create the delete statement for the row. So the delete statement
doesn't correctly identify the row.
The delete statements are currently created as strings but it looks like
prepared statements with parameters would work much better for UUIDs.
Conversions to string and back are just too dangerous when we take
embedded null characters and character set conversions into account.
A UUIDColumnDef class would be handy, possibly even with different data
presentation, similar to the UUID_TO_CHAR() function. It could keep the
octet string data as-is and convert it only for display.