-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add support for BYTEA/BLOB #511
Changes from 2 commits
520f456
26b5466
c963bcd
060b977
cc65dfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,6 +308,27 @@ SELECT * FROM json_tbl; | |
{} | ||
(4 rows) | ||
|
||
-- BLOB | ||
CREATE TABLE blob_tbl(a bytea); | ||
INSERT INTO blob_tbl SELECT CAST(a as bytea) FROM (VALUES | ||
('\x'), | ||
('\x110102030405060708090a0b0c0d0e0f'), | ||
(''), | ||
('\x00'), | ||
('\x07'), | ||
(NULL) | ||
) t(a); | ||
SELECT * from blob_tbl; | ||
a | ||
------------------------------------------------------------------------------------------------------------------------------------ | ||
\x | ||
\x5c7831315c7830315c7830325c7830335c7830345c7830355c7830365c7830375c7830385c7830395c7830415c7830425c7830435c7830445c7830455c783046 | ||
\x | ||
\x5c783030 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Okay, this needs to change. All the non empty bytea results are wrong. When using postgres execution the it instead gives the following rows:
It seems like you're encoding the string as hex somewhere as an additional time, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found it, converting it to string was trying to convert those bytes to string There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed GetValue to GetValueUnsafe for getting raw bytes in string_t |
||
\x5c783037 | ||
|
||
(6 rows) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comparison test too? Something like: SELECT * FROM blob_tbl WHERE a = '\x00'; |
||
-- REGCLASSOID | ||
CREATE TABLE regclass_tbl (a REGCLASS); | ||
INSERT INTO regclass_tbl VALUES (42), (3000000000); | ||
|
@@ -337,4 +358,5 @@ DROP TABLE bigint_numeric; | |
DROP TABLE hugeint_numeric; | ||
DROP TABLE uuid_tbl; | ||
DROP TABLE json_tbl; | ||
DROP TABLE blob_tbl; | ||
DROP TABLE regclass_tbl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
make format
will re-format this line asThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the report. Fixed by: #518