Skip to content

PostgreSQL setparameter() compatibility #19615

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

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

Prometee
Copy link
Contributor

Using PostgreSQL, Doctrine will use UUID field type. If you don't specify the parameter type it will try to send a string instead of the binary content and fail with an error :

SQLSTATE[22021]: Character not in repertoire: 7 ERROR:  invalid byte sequence for encoding \"UTF8\": ...
CONTEXT:  unnamed portal parameter $1

@javiereguiluz
Copy link
Member

Thanks for this contribution!

Personally I don't like adding details about specific databases because this makes docs very hard to maintain. But I don't know if there's an alternative in this case. Let's wait a bit to see if someone can propose another solution. Thanks!

@Prometee
Copy link
Contributor Author

@javiereguiluz what about adding a note after the code example ?

@vinceAmstoutz
Copy link
Contributor

Personally, I don't see a problem because ParameterType doesn't depend on PostgreSQL. I'll just remove the comment to be database agnostic.

@javiereguiluz javiereguiluz changed the base branch from 7.0 to 6.4 March 5, 2024 07:51
Using PostgreSQL, Doctrine will use UUID field type. If you don't specify the parameter type it will try to send a string instead of the binary content and fail with an error :

```
SQLSTATE[22021]: Character not in repertoire: 7 ERROR:  invalid byte sequence for encoding \"UTF8\": ...
CONTEXT:  unnamed portal parameter $1
```
@javiereguiluz
Copy link
Member

I like Vincent's proposal ... so, I kept your changes related to adding ParameterType::BINARY but removed the comment mentioning PostgreSQL. Just use this for all databases.

Thanks Francis and congrats on your first Symfony Docs contribution 🎉

@javiereguiluz javiereguiluz merged commit 7f9ea29 into symfony:6.4 Mar 5, 2024
@javiereguiluz javiereguiluz added this to the 6.4 milestone Mar 5, 2024
@vinceAmstoutz
Copy link
Contributor

I like Vincent's proposal ... so, I kept your changes related to adding ParameterType::BINARY but removed the comment mentioning PostgreSQL. Just use this for all databases.

Thanks Francis and congrats on your first Symfony Docs contribution 🎉

Unless I'm mistaken @javiereguiluz you didn't delete the comment

@javiereguiluz
Copy link
Member

You are right 🙏 I forgot to commit the changes I did while merging it 🤦

I've removed it in 99a0a12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants