Skip to content
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

Missing parantheses causes problems with HSTOREs containing newlines #117

Closed
saurabhnanda opened this issue Jul 26, 2024 · 5 comments
Closed
Assignees

Comments

@saurabhnanda
Copy link

In PostgreSQL, if an HSTORE column contains a newline, Jailer will export the value as...

'"key"=>"value' || chr(10) || 'with newlines"' :: hstore

... which results in the following error when executing in psql:

psql=# select '"key"=>"value' || chr(10) || 'with newlines"' :: hstore;
ERROR:  Syntax error near "n" at position 5
LINE 1: select '"key"=>"value' || chr(10) || 'with newlines"' :: hst...

However, if the HSTORE value were to be exported with parantheses, as shown below...

('"key"=>"value' || chr(10) || 'with newlines"') :: hstore

...I believe it would work:

psql=# select ('"key"=>"value' || chr(10) || 'with newlines"') :: hstore;
     hstore     
----------------
 "key"=>"value +
 with newlines"
(1 row)
@saurabhnanda saurabhnanda changed the title Missnig parantheses causes problems with HSTOREs containing newlines Missing parantheses causes problems with HSTOREs containing newlines Jul 26, 2024
@Wisser Wisser self-assigned this Jul 26, 2024
@Wisser
Copy link
Owner

Wisser commented Jul 31, 2024

Thank you for the error report!
This has been fixed in release 16.4.

@saurabhnanda
Copy link
Author

@Wisser thank you for the quick response. Actually, I discovered this to be a bug for TEXT columns as well. Does 16.4 fix that as well?

@Wisser
Copy link
Owner

Wisser commented Jul 31, 2024

Yes, it works for all literals. Let me know if you find any other issues.

@Wisser Wisser closed this as completed Nov 20, 2024
@saurabhnanda
Copy link
Author

saurabhnanda commented Dec 16, 2024

@Wisser I've come back to this issue to remove the HACK that I had put in my export model. Unfortunately, in the 16.4 UI, I cannot find where to remove the following from:

#! block filter templates
T;hstore fix;remove_newlines_from_hstore_value(${old-value});enabled;Export;;
C;TYPE;EQUALS;hstore;

@Wisser
Copy link
Owner

Wisser commented Dec 16, 2024

Did the fix work for you?

The entry in the model file is a “filter template”. These can be edited or deleted in the “Filter editor” (“Edit” -> “Filter editor”).
See screenshots.

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants