Skip to content

Change postgresql to use concat() instead of || - #19584

Open
othercorey wants to merge 1 commit into
cakephp:5.nextfrom
othercorey:postgres-concat
Open

Change postgresql to use concat() instead of ||#19584
othercorey wants to merge 1 commit into
cakephp:5.nextfrom
othercorey:postgres-concat

Conversation

@othercorey

Copy link
Copy Markdown
Contributor

I think this change probably belongs in 6.0.

PostgreSQL added concat() in 9.1 with proper support for NULL arguments - they are ignored instead of returning NULL

In postgrs, bound parameters have to be cast to text to satisfy the variadic arguments since it requires types be known at compile time to support argument overloading.

The concat() function should be what we want and only be safer, but since it would change the return type for NULL arguments, it's not technically backwards compatible.

@othercorey

Copy link
Copy Markdown
Contributor Author

@markstory Because only the bound parameters are cast, we could use the postgres shorthand :parm0::text if we wanted to keep the sql simpler.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant