Re: SQLJSON

From: Álvaro Hernández Tortosa <aht(at)8Kdata(dot)com>
To: Stephen Nelson <stephen(at)eccostudio(dot)com>, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: SQLJSON
Date: 2015-06-30 07:22:13
Message-ID: 559243A5.4020708@8Kdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 30/06/15 09:07, Stephen Nelson wrote:
>
> +1
>
> With the caveat that this is the least worst option. Json is just text
> so it can be easily parsed by your favourite json library.
>

Stephen, the idea is to provide "built-in" support for Json out of
the database, so that you don't need to parse it manually, which is a
pain for many users. Plus, it opens the door for future optimizations is
Json support is streamlined into the protocol.
>
> If I'm writing a web api which exposes json services I would be
> annoyed if my jdbc driver has decided which json library I'll use for
> my web api, or I'd have to use two different libraries and bloat my
> jar/war.
>

The current proposal does not force you, at all, to decide which
JSON library to use. It returns a JsonValue, which is a JSR spec, and
then you can do whatever you want. The RI is just 64Kb, so I wouldn't
call it bloat.... and in exchange for that, you get a fully working
driver with JSON support from the beginning.

Regards,

Álvaro

--
Álvaro Hernández Tortosa

-----------
8Kdata

>
> On Tue, 30 Jun 2015 00:01 Vladimir Sitnikov
> <sitnikov(dot)vladimir(at)gmail(dot)com <mailto:sitnikov(dot)vladimir(at)gmail(dot)com>> wrote:
>
> Álvaro, Dave,
>
> If I understand you right, you "just" want to make "usage of json
> feature" easy for end-users.
> So do I.
> If there is more, please add.
>
> What if we do the following?
> 1) We keep "base" part of driver "unaware" of json. In other words,
> calls like getObject(1, JsonValue.class) would end up in "@throws
> SQLException if conversion is not supported" (as per ResultSet's
> javadoc)
> 2) Add "pgjdbc-json" module (i.e. jar) that adds support for
> getObject(1, JsonValue.class), setObject(1, JsonValue) kind of calls.
> 3) Document "best choice of json dependencies" right in the readme. I
> think we would be fine even with simple "we tested just jackson and it
> works with pgjdbc".
>
> From the end-user perspective it will be:
> 1) Using driver as usual -- "just add one mvn dependency" --
> 'org.postgresql:postgresql:9.4-1201-jdbc41'
> 2) Adding json support -- add additional one --
> 'org.postgresql:postgresql-json:9.4-1201-jdbc41' and
> 'best-of-the-best-pgjdbc-approved-json-impl:3.14.15'.
>
> Both items would be available on the top of readme as copy&paste
> ready snippets.
>
> This covers "json support" and it is user-friendly: no additional
> googling is required to use the feature.
> Am I missing anything?
>
> Vladimir
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org
> <mailto:pgsql-jdbc(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

In response to

  • Re: SQLJSON at 2015-06-30 07:07:14 from Stephen Nelson

Responses

  • Re: SQLJSON at 2015-06-30 07:57:03 from Vladimir Sitnikov

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2015-06-30 07:57:03 Re: SQLJSON
Previous Message Stephen Nelson 2015-06-30 07:07:14 Re: SQLJSON