-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: add full_match_handler.go to convert the query. #299
base: main
Are you sure you want to change the base?
Conversation
@NoyException Is this issue the final obstacle to making the C# client functional? If so, we should consider enabling the test in this PR. |
I'll enable it. |
This is only the current obstacle, not the last one... |
…c once per statement.
# Conflicts: # pgserver/stmt.go
# Conflicts: # flightsqltest/driver_test.go
@@ -0,0 +1,420 @@ | |||
oid,relname,relnamespace,reltype,reloftype,relowner,relam,relfilenode,reltablespace,relpages,reltuples,relallvisible,reltoastrelid,relhasindex,relisshared,relpersistence,relkind,relnatts,relchecks,relhasrules,relhastriggers,relhassubclass,relrowsecurity,relforcerowsecurity,relispopulated,relreplident,relispartition,relrewrite,relfrozenxid,relminmxid,relacl,reloptions,relpartbound |
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.
It would be better to add a script for generating these files:
CONTAINER_ID=$(docker run --rm -d -e POSTGRES_PASSWORD=postgres postgres)
docker exec -i $CONTAINER_ID psql -U postgres -c '\COPY pg_class TO STDOUT (FORMAT CSV)' > pg_class.csv
...
docker kill $CONTAINER_ID
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.
This approach may not work with cloud vendors in China, as the machine might not be able to connect to Docker Hub.
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.
I mean a script for maintainers to regenerate these files easily.
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.
Got it.I'll leave a script with README later.
|
||
var queryPatterns = map[*regexp.Regexp]string{ | ||
regexp.MustCompile(`(?is)^SELECT\s+pg_type\.oid,\s*enumlabel\s+FROM\s+pg_enum\s+JOIN\s+pg_type\s+ON\s+pg_type\.oid=enumtypid\s+ORDER\s+BY\s+oid,\s+enumsortorder$`): "SELECT pg_type.oid, pg_enum.enumlabel FROM pg_enum JOIN pg_type ON pg_type.oid=enumtypid ORDER BY pg_type.oid, pg_enum.enumsortorder;", | ||
} |
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.
Such long regular expressions are expensive to evaluate. Could we does something like:
if removeSpace(inputQuery) == pattern {
...
}
where removeSpace
is a faster implementation? https://stackoverflow.com/a/32081891
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.
Good idea! Will be fixed in next commit.
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.
fixed
This PR resolves issues #297 and #316, addressing compatibility challenges with Npgsql in C#.
Issue 1: Real Data for PostgreSQL System Tables
In PostgresDatabaseInfo.cs, 4 hard-coded queries are executed, with the results accessed via
ReadNonNullableString
. To ensure compatibility and non-null results, real PostgreSQL system table data are mirrored in MyDuck Server. Additionally, all PostgreSQL system table queries are redirected to their corresponding__sys__.pg_xxx
tables in DuckDB.Issue 2: Discontinuous Data in Batches
As discussed in #316, query results are split into multiple batches and returned discontinuously due to each batch containing a separate
RowDescription
. This PR introduces a mechanism to ensure that only a singleRowDescription
is returned per statement execution, providing a continuous result stream for better compatibility with Npgsql.