-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Clarify node-pg's strategy for the JSON data type in Postgres #239
Conversation
I would like to support it fully. I'm not on postgres 9.2 on any of my apps yet -- would you be able to provide a simple script example? I can work that into a failing test & then passing test and then, boom, feature. |
Will do. |
Once travis-ci gets 9.2 I'll roll out support for using |
+1 for this feature. |
I totally agree. Anyone know off the top of their head the status on pg @ 9.2 on travis-ci? |
I do not, sorry. On Mar 22, 2013, at 9:45 AM, Brian C notifications@github.com wrote:
|
Now that we've got Postgres9.2 on travis I can work on adding in some tests and support for the JSON oids. They'll only run if |
fantastic, thanks @brianc ! |
requires >= 9.2 of postgres
Forgot to add this to the last commit
Uhhh I kinda jacked this up by branching off another feature branch but it should merge cleanly since it was the last thing in the history. git pwns us all. |
Tests passing. Postgres @ 9.1 (travis's default version) Postgres @ 9.2 💃 🎉 |
@nicholasf |
Apologies if I'm in the wrong spot here, but do we need the "contains" (@>) operator to also work with this? Have put an example in the open hstore parser issue. Not sure if this is a general parsing issue, or something specific to json/hstore? |
Everything in the query text gets passed directly to the backend PostgreSQL server without any manipulation what so ever by node or node-postgres apart from |
Think the issue I'm having is with prepared statements and hstore under pg v1.1.0: Running this...
.... raises the following entry in my Postgres.app log....
... hinting that $1 is not being expanded? Prepared statements with hstore parameters do work OK inside PLSQL :
Somewhere along the way the JSON is not being accepted as a parameter by postgres? (probably something I'm doing wrong, but could someone confirm the above code and schema work from them?) Thanks for any ideas, and a great library 👍 |
The issue is I am confusing hstore with JSON :) [slaps forehead] Was hoping that Postgres would provide a converter, but no luck. Maybe 9.3 will have something. In the mean time, wrote a little JS function:
Which might help someone in this way:
|
Hi Brian,
Could you please mention what you think node-pg should be doing to handle the JSON data type that appeared in Postgres 9.2?
I've asked for more info here previously:
#208 (comment)
It'd be ideal if node-pg could parse or stringify the value of the json column going out or coming into postgres. If you need a hand with it let us know (although I also said that about node-sql and we've been super busy). In the interim we need to form a strategy for handling json data using node-pg.
Cheers!
Nick