huntlabs / hunt-database

Database abstraction layer library using pure D programing language, support PostgreSQL and MySQL.
https://www.huntlabs.net
Apache License 2.0
48 stars 5 forks source link

PostgreSQL (14.0) driver: It seems that scram-sha-256 authentication is not supported #58

Open katyukha opened 2 years ago

katyukha commented 2 years ago

Hi,

First of all, thanks for great hunt-framework product, that looks good and easy to start.

Below is description of bug that i have spotted recently, when i tried to coonect postgres database to project that uses hunt-framework


When i try to connect to postgres server 14, i got following warning/error:

warning | doEecode | hunt.Exceptions.UnsupportedOperationException@../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d(430): Authentication type 10 is not supported inBuffer the client
----------------
../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d:430 void hunt.database.driver.postgresql.impl.codec.PgDecoder.PgDecoder.decodeAuthentication(hunt.net.buffer.ByteBuf.ByteBuf) [0x55a94d3f5c50]
../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d:203 void hunt.database.driver.postgresql.impl.codec.PgDecoder.PgDecoder.decodeMessage(byte, hunt.net.buffer.ByteBuf.ByteBuf) [0x55a94d3f53af]
../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d:155 hunt.io.channel.Common.DataHandleStatus hunt.database.driver.postgresql.impl.codec.PgDecoder.PgDecoder.doEecode(hunt.io.ByteBuffer.ByteBuffer, hunt.net.Connection.Connection) [0x55a94d3f51c7]
../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d:87 hunt.io.channel.Common.DataHandleStatus hunt.database.driver.postgresql.impl.codec.PgDecoder.PgDecoder.decode(hunt.io.ByteBuffer.ByteBuffer, hunt.net.Connection.Connection) [0x55a94d3f4f2b]
../../../.dub/packages/hunt-net-0.7.1/hunt-net/source/hunt/net/AbstractConnection.d:178 hunt.io.channel.Common.DataHandleStatus hunt.net.AbstractConnection.AbstractConnection.handleReceivedData(hunt.io.ByteBuffer.ByteBuffer) [0x55a94dc2ced8]
../../../.dub/packages/hunt-net-0.7.1/hunt-net/source/hunt/net/AbstractConnection.d:159 hunt.io.channel.Common.DataHandleStatus hunt.net.AbstractConnection.AbstractConnection.onDataReceived(hunt.io.ByteBuffer.ByteBuffer) [0x55a94dc2ce03]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/io/channel/posix/AbstractStream.d:83 void hunt.io.channel.posix.AbstractStream.AbstractStream.onDataReceived(hunt.io.ByteBuffer.ByteBuffer) [0x55a94dd60788]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/io/channel/posix/AbstractStream.d:142 bool hunt.io.channel.posix.AbstractStream.AbstractStream.tryRead() [0x55a94dd60916]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/io/TcpStream.d:428 void hunt.io.TcpStream.TcpStream.onRead() [0x55a94dd5ed3c]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/event/selector/Epoll.d:228 void hunt.event.selector.Epoll.AbstractSelector.handeChannelEvent(hunt.io.channel.AbstractChannel.AbstractChannel, uint) [0x55a94dd56ae3]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/event/selector/Epoll.d:173 int hunt.event.selector.Epoll.AbstractSelector.doSelect(long) [0x55a94dd56a2b]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/event/selector/Selector.d:195 void hunt.event.selector.Selector.Selector.onLoop(long) [0x55a94dd57492]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/event/selector/Selector.d:155 void hunt.event.selector.Selector.Selector.doRun(void delegate()) [0x55a94dd57305]
../../../.dub/packages/hunt-1.7.15/hunt/source/hunt/event/selector/Selector.d:120 nothrow void hunt.event.selector.Selector.Selector.runAsync(long, void delegate()).__lambda3() [0x55a94dd571f3]
??:? void core.thread.context.Callable.opCall() [0x55a94ddc7da8]
??:? thread_entryPoint [0x55a94ddc7886]
??:? [0x7fc66c3a5946]
??:? clone [0x7fc66c435a43] | ../hunt-database/source/hunt/database/driver/postgresql/impl/codec/PgDecoder.d:160

By the way, why not to use libpq bindings?

Heromyth commented 2 years ago

The vertx-sql-client has fixed this, see https://github.com/eclipse-vertx/vertx-sql-client/pull/412. So we can keep up with this.

As for using libpq binding, it's another thing.