Re: Basic JSON support

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Basic JSON support
Date: 2010-10-05 05:12:38
Message-ID: AANLkTim8xoUvw7Q-muDSfvgYH1iXK5k=D66mp74mk9LO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/10/5 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Oct 4, 2010 at 2:50 PM, Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com> wrote:
>>> If he doesn't respond, or outright refuses (which I, for one, doubt
>>> will happen), my fallback plan is to rewrite the JSON validation code
>>> by drawing from my original code (meaning it won't be in bison/flex)
>>> and post a patch for it.  Unfortunately, it seems to me that there
>>> aren't very many ways of expressing a JSON parser in bison/flex, and
>>> thus the idea of JSON parsing with bison/flex is effectively locked
>>> down by the GPL unless we can get a more permissive license for
>>> jsonval.  But, I am not a lawyer.
>
>> If someone who hasn't looked at the GPL code sits down and codes
>> something up based on the json.org home page, it's hard to imagine how
>> anyone could be grumpy about that.
>
> Yeah.  Joseph seems to be confusing copyrights with patents.  The idea
> of "parse JSON with bison/flex" is not patentable by any stretch of the
> imagination.
>
> But having said that, I wonder whether bison/flex are really the best
> tool for the job in the first place.  From what I understand of JSON
> (which admittedly ain't much) a bison parser seems like overkill:
> it'd probably be both bloated and slow compared to a simple handwritten
> recursive-descent parser.

PostgreSQL use a bison for same simple things - cube, PostGis,
bootstrap .. so I don't see some special overhead. I am thinking so
lex can be shared from core parser. bison parser for JSON means a less
rows for maintaining a repeating some a basic pattern in pg source
code.

Regards

Pavel Stehule

./contrib/seg/segparse.y
./contrib/cube/cubeparse.y
./src/backend/bootstrap/bootparse.y
./src/backend/parser/gram.y
./src/pl/plpgsql/src/gram.y
./src/interfaces/ecpg/preproc/preproc.y

>
>                        regards, tom lane
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2010-10-05 06:04:31 Re: wip: functions median and percentile
Previous Message Fujii Masao 2010-10-05 04:29:10 Re: ALTER DATABASE RENAME with HS/SR