Skip to content
Snippets Groups Projects
Commit 7525072c authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

pgsql: Autoconvert to UTF-8 for types as CITEXT.

parent c712594b
No related branches found
No related tags found
No related merge requests found
...@@ -1233,7 +1233,7 @@ class sql_result { ...@@ -1233,7 +1233,7 @@ class sql_result {
plugbuffer->add_int32(-1); plugbuffer->add_int32(-1);
break; break;
} }
if (!objectp(value) || typeof(value) != typeof(Stdio.Buffer())); if (!objectp(value) || typeof(value) != typeof(Stdio.Buffer()))
/* /*
* Like Oracle and SQLite, we accept literal binary values * Like Oracle and SQLite, we accept literal binary values
* from single-valued multisets. * from single-valued multisets.
...@@ -1242,20 +1242,20 @@ class sql_result { ...@@ -1242,20 +1242,20 @@ class sql_result {
value = indices(value)[0]; value = indices(value)[0];
else { else {
value = (string)value; value = (string)value;
if (String.width(value) > 8) if (cenc == UTF8CHARSET
if (dtoid[i] == BYTEAOID) && (dtoid[i] != BYTEAOID || String.width(value) > 8))
/* /*
* FIXME We should throw an error here, it would * FIXME For BYTEAOID and wide strings we should
* have been correct, but for historical reasons and * throw an error here, but for historical reasons and
* as a DWIM convenience we autoconvert to UTF8 here. * as a DWIM convenience we autoconvert to UTF8 anyway.
*/ */
value = string_to_utf8(value); value = string_to_utf8(value);
else { else if (String.width(value) > 8) {
SUSERERROR( SUSERERROR(
"Wide string %O not supported for type OID %d\n", "Wide string %O not supported for type OID %d\n",
value, dtoid[i]); value, dtoid[i]);
value = ""; value = "";
} }
} }
plugbuffer->add_hstring(value, 4); plugbuffer->add_hstring(value, 4);
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment