benbjohnson / postlite

Postgres wire compatible SQLite proxy.
Apache License 2.0
1.22k stars 31 forks source link

Support for PostgreSQL JDBC #23

Open jasoneer opened 1 year ago

jasoneer commented 1 year ago

When using the PostgreSQL JDBC driver via Datagrip IDE, the following happens:

[recv] &pgproto3.Parse{Name:"", Query:"select ssl from pg_stat_ssl where pid = pg_backend_pid()", ParameterOIDs:[]uint32(nil)}
connection error, closing: parse message: prepare: no such table: pg_stat_ssl

I also get an Connection was established but closed as invalid message from Datagrip

Full log from start to error:

listening on :5432
connection accepted:  127.0.0.1:41900
received startup message: &pgproto3.StartupMessage{ProtocolVersion:0x30000, Parameters:map[string]string{"DateStyle":"ISO", "TimeZone":"UTC", "client_encoding":"UTF8", "database":"cache.db", "extra_float_digits":"2", "user":"jason"}}
[recv] &pgproto3.Parse{Name:"", Query:"SET extra_float_digits = 3", ParameterOIDs:[]uint32(nil)}
query rewrite: SELECT 'SET'
[recv(p)] &pgproto3.Bind{DestinationPortal:"", PreparedStatement:"", ParameterFormatCodes:[]int16(nil), Parameters:[][]uint8(nil), ResultFormatCodes:[]int16{}}
[recv(p)] &pgproto3.Execute{Portal:"", MaxRows:0x1}
[recv] &pgproto3.Sync{}
[recv] &pgproto3.Parse{Name:"", Query:"SET application_name = ''", ParameterOIDs:[]uint32(nil)}
query rewrite: SELECT 'SET'
[recv(p)] &pgproto3.Bind{DestinationPortal:"", PreparedStatement:"", ParameterFormatCodes:[]int16(nil), Parameters:[][]uint8(nil), ResultFormatCodes:[]int16{}}
[recv(p)] &pgproto3.Execute{Portal:"", MaxRows:0x1}
[recv] &pgproto3.Sync{}
[recv] &pgproto3.Parse{Name:"", Query:"select version()", ParameterOIDs:[]uint32(nil)}
[recv(p)] &pgproto3.Bind{DestinationPortal:"", PreparedStatement:"", ParameterFormatCodes:[]int16(nil), Parameters:[][]uint8(nil), ResultFormatCodes:[]int16{}}
[recv(p)] &pgproto3.Describe{ObjectType:0x50, Name:""}
[recv(p)] &pgproto3.Execute{Portal:"", MaxRows:0x0}
[recv] &pgproto3.Sync{}
[recv] &pgproto3.Parse{Name:"", Query:"SET application_name = 'WebStorm 2023.2.1'", ParameterOIDs:[]uint32(nil)}
query rewrite: SELECT 'SET'
[recv(p)] &pgproto3.Bind{DestinationPortal:"", PreparedStatement:"", ParameterFormatCodes:[]int16(nil), Parameters:[][]uint8(nil), ResultFormatCodes:[]int16{}}
[recv(p)] &pgproto3.Execute{Portal:"", MaxRows:0x1}
[recv] &pgproto3.Sync{}
[recv] &pgproto3.Parse{Name:"", Query:"", ParameterOIDs:[]uint32(nil)}
[recv(p)] &pgproto3.Bind{DestinationPortal:"", PreparedStatement:"", ParameterFormatCodes:[]int16(nil), Parameters:[][]uint8(nil), ResultFormatCodes:[]int16{}}
[recv(p)] &pgproto3.Describe{ObjectType:0x50, Name:""}
[recv(p)] &pgproto3.Execute{Portal:"", MaxRows:0x1}