alekitto / messenger-extra

Additional transports and serializer support for symfony messenger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostgreSql incompatibility for UuidBinaryOrderedTimeType

massimilianobraglia opened this issue · comments

Hey there,

we're facing a problem while inserting messages in our table.
As stated here ramsey/uuid#179 and here ramsey/uuid-doctrine#47 (comment), using UuidBinaryOrderedTimeType and UuidBinaryType are intended primarly for MySQL/MariaDB DBMS. Instead, for PostgreSql is intended the UuidType.

In fact, the insert results in the following error:

INSERT INTO queue_api (id, published_at, body, headers, properties, priority, time_to_live, delayed_until) VALUES ('9a304ec0-7241-11e9-b7f6-0242ac12000c', '2019-05-09 10:02:49', '{"message_body":"the body"}', '{"type": "App\Messenge\FullyQualified\Name"}', '[]', 0, null, null)

ERROR: invalid byte sequence for encoding "UTF8": 0xe9 0x72 0x42

I have time to make a PR, but before a little discussion:
Explicitly checking the Database platform at this line seems not so elegant.
\Kcs\MessengerExtra\Transport\Dbal\DbalSender::send#line79

Any advice?

PS:
To reproduce this is really simple: just try to persist a new message with Symfony + Doctrine (and obviously Messenger with this bundle)

Seems that binary (LARGE_OBJECT) flags was not set in getBindingType method of none of the uuid-doctrine types. This leads to that error in postgresql as the server does not expect binary values.

Workin' on it

Exactly. The merged a PR on that and reverted because is platform dependant. (you can find a closed PR on ramsey/uuid-doctrine)

Should be fixed in master (ref: 70779b4)

Ok, thank you. I'll let you know if it solves my issue

@alekitto seems to work fine! Thank you 😄