-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UUID support #42
Comments
Firebird does not have an explicit UUID type, but provides a function "gen_uuid()" which generates a UUID as a series of raw byte values. These can either be stored in a column defined with "CHARACTER SET OCTETS", or converted to a string with "uuid_to_char()" for storage in a normal text column. However, if a PostgreSQL UUID value is pushed down as a string literal, any UUID comparisons will fail unless the corresponding value in Firebird is normalised in the same way as PostgreSQL (which is likely not the case, as "uuid_to_char()" produces UUIDs formatted with upper-case characters, whereas PostgreSQL normalizes to lower-case values, per RFC4122 [1]). To avoid this, we can simply not push down UUID values, so comparisons can be performed on the PostgreSQL side, which accepts a range of formats as valid UUID input values [2]. This is less efficient than performing comparisons on the Firebird side; this could be implemented later, but would require knowledge of how the UUID is stored in Firebird (expressed as a column-level option or similar). Note that currently no provision exists for inserting UUID values into Firebird "CHARACTER SET OCTETS" columns. [1] https://datatracker.ietf.org/doc/html/rfc4122 [2] https://www.postgresql.org/docs/current/datatype-uuid.html This patch assumes a libfq version with support for "CHARACTER SET OCTETS". Addresses issues in GitHub #42.
OK, this is an issue with (...)
I've had a look at the issue; it's a bit tricky because Firebird does not have an explicit However as a simple, initial solution, we can simply avoid pushing down the UUID value, so any comparisons are performed on the PostgreSQL side, which accepts various input formats for UUID values. In many cases this will be less efficient than performing the comparison in Firebird, but better than nothing.
Thanks for the support and feedback over the years :). |
Thanks, @ibarwick !
1. Around of
I think no problems. In Firebird as RDBMS getting C
I think it will be not very hard to pushdown UUID comparsion for 2. Simple text case is more harder.
Let's discuss. I have no preferred implementation. What about examples?
It seems there are no examples. Let's collect some potentially helpful facts.
What about deparsing to Notes about
Hence this function needs stable input length (no P. S. What about my PR #38 ? Your documentation was selected as something like reference implementation for most of FDWs from https://github.com/pgspider. This PR is my feedback, because I think there is some usefully traditions for this |
Ping, @ibarwick ! My PR with UUID support in SQLite-FDW was merged. Thanks for inspiration! How can I help you here? Maybe test something about text transformation, see previous message? |
Ping, @ibarwick . After pgspider/sqlite_fdw@a272452 in |
Hello, @ibarwick!
You have powerful inspired me for C FDW contributing. Some hours ago I have implemented UUID support for sqlite_fdw and check SQLite to Firebird data transport. Unfortunately there is some problems. Let's test.
Firebird gives us some UUID functions. Recommended special storage mode is
CHAR(16) CHARACTER SET OCTETS
.Firebird
PostgreSQL
First problem
During
select * from uuid;
there is error with malformed input.Note: for text stored UUIDs there is no
SELECT
problemsFirebird
PostgreSQL
Sample listing
Second problem
Let's
SELECT
from text stored UUID columnNormalized FirebirdSQL form for UUID look like
91F8B0F1-DB13-44F0-91C8-71A1ACC402CF
Normalized PostgreSQL form for UUID look like
91f8b0f1-db13-44f0-91c8-71a1acc402cf
Before
WHERE
PostgreSQL normalize UUID value. Hence firebird_fdw should makeupper
transformation.My help
I have resolved a problem with malformed UUID input from SQLite
blob
affinity and binding PostgreSQL UUID value to SQLiteblob
. Some solution there is in https://github.com/mkgrgis/sqlite_fdw/blob/draft_uuid/sqlite_query.c You can borrow this code.Also you can point me to some lines in firebird_fdw code where i can try to add UUID support.
Many thanks for the long and hard work with firebird_fdw code!
The text was updated successfully, but these errors were encountered: