Skip to content
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

Added Postgres specific || operator for concatenating two jsonb values #458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mputz86
Copy link
Contributor

@mputz86 mputz86 commented May 17, 2020

I am not sure if the operator naming is correct and if it is ok to introduce these PostgreSQL specific operators like this (not so much experienced in Haskell yet). But anyway, I try my luck and hope at least to get feedback on how to do it correctly :D.
Here is the official description of the || jsonb-concatenator operator as well as some more https://www.postgresql.org/docs/11/functions-json.html (maybe I can add some more ;) ).
Thank you.

Copy link
Member

@kmicklas kmicklas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It's definitely nice to support as many operators as we can.

beam-postgres/Database/Beam/Postgres/PgSpecific.hs Outdated Show resolved Hide resolved
@mputz86
Copy link
Contributor Author

mputz86 commented May 18, 2020

Also got some conflict with the ||. from Database.Beam. So either the operators should be named different than in Postgres or (like now) hiding the one from Database.Beam and let the user import Postgres specific stuff qualified (like I did it :D 🤷‍♂️ ). Dont know what is the right solution here.

@kmicklas
Copy link
Member

Ah good point, I totally forgot that ||. is already taken. Unless you can think of a better operator name that makes sense (I can't), then I'd suggest just giving it a name like pgJsonbConcat.

@mputz86
Copy link
Contributor Author

mputz86 commented May 20, 2020

Then for me the question is "where" to put it in code:

  • put it close (i.e. maybe at the end of) the pgJsonbABC things or
  • keep it in the order of the Postgres doc (like obviously all the rest is right now) and put it after (?&) but before withoutKey :)

Sry, too much discussion for such a small thing? :D

@kmicklas
Copy link
Member

I don't think it matters much but probably nice to keep the order in line with the Postgres docs where possible.

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.

2 participants