Branch: Tag:

2020-05-28

2020-05-28 18:52:47 by Stephen R. van den Berg <srb@cuci.nl>

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

1233:    plugbuffer->add_int32(-1);    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    * from single-valued multisets.
1242:    value = indices(value)[0];    else {    value = (string)value; -  if (String.width(value) > 8) -  if (dtoid[i] == BYTEAOID) +  if (cenc == UTF8CHARSET +  && (dtoid[i] != BYTEAOID || String.width(value) > 8))    /* -  * FIXME We should throw an error here, it would -  * have been correct, but for historical reasons and -  * as a DWIM convenience we autoconvert to UTF8 here. +  * FIXME For BYTEAOID and wide strings we should +  * throw an error here, but for historical reasons and +  * as a DWIM convenience we autoconvert to UTF8 anyway.    */    value = string_to_utf8(value); -  else { +  else if (String.width(value) > 8) {    SUSERERROR(    "Wide string %O not supported for type OID %d\n",    value, dtoid[i]);