-
Notifications
You must be signed in to change notification settings - Fork 551
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
Problem with Npgsql 8: A PostgreSQL type with the name 'unknown' was not found in the current database info #15281
Comments
/cc @NinoFloris |
@roji: Thank you for tagging @NinoFloris. Nino, I just discovered you made an attempt with npgsql/npgsql@a5aa54b3d to fix this on behalf of Npgsql, thank you very much for your efforts. I guess it will be a good idea to take the chance to improve PostgreSQL compatibility on CrateDB, but, at the same time, we can't travel back in time to improve previous releases, so your compatibility fix could be suitable for people aiming to use Npgsql 8 to connect to previous versions of CrateDB. |
Closes #15281 Looks like in PostgreSQL it is handled as cstring: From `varlena.c`: /* * unknownin - converts cstring to internal representation */ Datum unknownin(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); /* representation is same as cstring */ PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownout - converts internal representation to cstring */ Datum unknownout(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownrecv - converts external binary format to unknown */ Datum unknownrecv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); char *str; int nbytes; str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); /* representation is same as cstring */ PG_RETURN_CSTRING(str); } /* * unknownsend - converts unknown to binary format */ Datum unknownsend(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); StringInfoData buf; pq_begintypsend(&buf); pq_sendtext(&buf, str, strlen(str)); PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); }
Closes #15281 Looks like in PostgreSQL it is handled as cstring: From `varlena.c`: /* * unknownin - converts cstring to internal representation */ Datum unknownin(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); /* representation is same as cstring */ PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownout - converts internal representation to cstring */ Datum unknownout(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownrecv - converts external binary format to unknown */ Datum unknownrecv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); char *str; int nbytes; str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); /* representation is same as cstring */ PG_RETURN_CSTRING(str); } /* * unknownsend - converts unknown to binary format */ Datum unknownsend(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); StringInfoData buf; pq_begintypsend(&buf); pq_sendtext(&buf, str, strlen(str)); PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); }
Closes #15281 Looks like in PostgreSQL it is handled as cstring: From `varlena.c`: /* * unknownin - converts cstring to internal representation */ Datum unknownin(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); /* representation is same as cstring */ PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownout - converts internal representation to cstring */ Datum unknownout(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); PG_RETURN_CSTRING(pstrdup(str)); } /* * unknownrecv - converts external binary format to unknown */ Datum unknownrecv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); char *str; int nbytes; str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); /* representation is same as cstring */ PG_RETURN_CSTRING(str); } /* * unknownsend - converts unknown to binary format */ Datum unknownsend(PG_FUNCTION_ARGS) { /* representation is same as cstring */ char *str = PG_GETARG_CSTRING(0); StringInfoData buf; pq_begintypsend(&buf); pq_sendtext(&buf, str, strlen(str)); PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); }
CrateDB version
5.5.1
CrateDB setup information
Standard, e.g. Docker.
Problem description
When connecting to CrateDB using Npgsql 8.0.0, which has been released in November 2023, it fails like outlined at crate/crate-qa#289 and below, with the error message
A PostgreSQL type with the name 'unknown' was not found in the current database info
. The problem has also been reported on the community forum, and there is also an upstream conversation about this topic.Steps to Reproduce
I can't provide a dedicated repro yet, but the corresponding code in crate-qa already triggers the problem, see crate/crate-qa#289.
Actual Result
Expected Result
Connecting to CrateDB works, even with Npgsql 8.x.x.
Possible Solutions
@roji, the author of Npgsql, recommends at npgsql/npgsql#5503 (comment):
The text was updated successfully, but these errors were encountered: