pgquarrel
pgquarrel copied to clipboard
GENERATED AS IDENTITY support
This adds support for GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
(introduced in PG 10).
I'm not sure I got all the queries right (particularly around the sequence one) but in my local tests this appears to work as expected. Please let me know if there is any feedback I can apply since I'm relatively new to introspecting PostgreSQL in this way!
Note that there are edge cases that are broken: you can't go from SERIAL
to IDENTITY
and vice versa. The issue with this is that the GENERATED ... IDENTITY
manages its sequence internally and we quarrel sequences first so you get some bad behaviors. In general, converting between the two seems like a problem since maintaining the correct sequence point is a PITA, and I'm not sure if pgquarrel wants to even attempt this, but perhaps an error is more appropriate here or ignoring that change entirely...