Skip to content

Commit

Permalink
Revert "feat: support multiple statements in one query (`implicit tra…
Browse files Browse the repository at this point in the history
…nsaction block` not implemented)"

This reverts commit ba451a6.
  • Loading branch information
NoyException committed Dec 17, 2024
1 parent ba451a6 commit 44421ea
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 181 deletions.
17 changes: 10 additions & 7 deletions compatibility/pg-pytools/psycopg_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from psycopg import sql
import psycopg

rows = [
Expand All @@ -12,14 +13,16 @@
with psycopg.connect("dbname=postgres user=postgres host=127.0.0.1 port=5432", autocommit=True) as conn:
# Open a cursor to perform database operations
with conn.cursor() as cur:
cur.execute("DROP SCHEMA IF EXISTS test CASCADE")
cur.execute("CREATE SCHEMA test")

cur.execute("""
DROP SCHEMA IF EXISTS test CASCADE;
CREATE SCHEMA test;
CREATE TABLE test.tb1 (
id integer PRIMARY KEY,
num integer,
data text)
""")
CREATE TABLE test.tb1 (
id integer PRIMARY KEY,
num integer,
data text)
""")


# Pass data to fill a query placeholders and let Psycopg perform the correct conversion
cur.execute(
Expand Down
2 changes: 0 additions & 2 deletions compatibility/pg/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ start_process() {
start_process $BATS_TEST_DIRNAME/c/pg_test 127.0.0.1 5432 postgres "" $BATS_TEST_DIRNAME/test.data
}

# Failed because of the following error:
# > Catalog Error: Table with name pg_range does not exist!
# @test "pg-csharp" {
# set_custom_teardown "sudo pkill -f dotnet"
# start_process dotnet build $BATS_TEST_DIRNAME/csharp/PGTest.csproj -o $BATS_TEST_DIRNAME/csharp/bin
Expand Down
14 changes: 7 additions & 7 deletions pgserver/connection_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ const (
ReadyForQueryTransactionIndicator_FailedTransactionBlock ReadyForQueryTransactionIndicator = 'E'
)

// ConvertedStatement represents a statement that has been converted from the Postgres representation to the Vitess
// representation. String may contain the string version of the converted statement. AST will contain the tree
// version of the converted statement, and is the recommended form to use. If AST is nil, then use the String version,
// ConvertedQuery represents a query that has been converted from the Postgres representation to the Vitess
// representation. String may contain the string version of the converted query. AST will contain the tree
// version of the converted query, and is the recommended form to use. If AST is nil, then use the String version,
// otherwise always prefer to AST.
type ConvertedStatement struct {
type ConvertedQuery struct {
String string
AST tree.Statement
Tag string
StatementTag string
PgParsable bool
SubscriptionConfig *SubscriptionConfig
BackupConfig *BackupConfig
Expand Down Expand Up @@ -86,7 +86,7 @@ type copyFromStdinState struct {
}

type PortalData struct {
Statement ConvertedStatement
Query ConvertedQuery
IsEmptyQuery bool
Fields []pgproto3.FieldDescription
ResultFormatCodes []int16
Expand All @@ -96,7 +96,7 @@ type PortalData struct {
}

type PreparedStatementData struct {
Statement ConvertedStatement
Query ConvertedQuery
ReturnFields []pgproto3.FieldDescription
BindVarTypes []uint32
Stmt *duckdb.Stmt
Expand Down
Loading

0 comments on commit 44421ea

Please sign in to comment.