Re: JSON for PG 9.2 - Mailing list pgsql-hackers

From Christopher Browne
Subject Re: JSON for PG 9.2
Date
Msg-id CAFNqd5W+P+tTrCK52CEf-koxzWrFNJGZAG64zef+z6mbu+e=9w@mail.gmail.com
Whole thread Raw
In response to Re: JSON for PG 9.2  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
On Mon, Dec 19, 2011 at 5:49 AM, Dimitri Fontaine
<dimitri@2ndquadrant.fr> wrote:
> My understanding is that JSON is a subset of ECMAscript, so if you get
> the latter you already have the former.  Now, someone would have to
> check if plscheme still build with guile-2.0, and given that, how
> exactly you get pl/ecmascript (or pl/js) out of that.

I don't think so.

I checked it out (still on pgfoundry, still on CVS, and code hasn't
been touched since 2008), and run into some issues.

- It looks for libguile.h #include "libguile.h"
which, on 2.0, has shifted around from /usr/include/libguile.h (1.8)
to /usr/include/guile/2.0/libguile.h

It's not doing enough indirections internally; there is a guile-config
that is analogous to pg_config

postgres@cbbrowne [03:48:43] [~/PostgreSQL/plscheme]
-> % guile-config compile
-pthread -I/usr/include/guile/2.0
postgres@cbbrowne [03:48:45] [~/PostgreSQL/plscheme]
-> % guile-config link
-lguile-2.0 -lgc

It looks like there's something PG-related as a next issue:

-> % ./install.sh
pg_config     : /var/lib/postgresql/dbs/postgresql-HEAD/bin/pg_config
module-dir    : /var/lib/postgresql/dbs/postgresql-HEAD/lib
max-cache-size: 64
dbname        : postgres
safe-r5rs     : NO
dbacreate     : NO
PSQL          : /var/lib/postgresql/dbs/postgresql-HEAD/bin/psql  postgres
CPPFLAGS      : -g -Wall -fpic -c
-I/var/lib/postgresql/dbs/postgresql-HEAD/include/server
-I/usr/include/guile/2.0
LDFLAGS       : -shared -lguile

Compiling... failed!

plscheme.c: In function '_PG_init':
plscheme.c:647:2: warning: implicit declaration of function
'DefineCustomStringVariable' [-Wimplicit-function-declaration]
plscheme.c:650:30: error: 'PGC_BACKEND' undeclared (first use in this function)
plscheme.c:650:30: note: each undeclared identifier is reported only
once for each function it appears in
plscheme.c:652:2: warning: implicit declaration of function
'DefineCustomIntVariable' [-Wimplicit-function-declaration]
plscheme.c: In function 'plscheme_func_handler':
plscheme.c:742:2: warning: implicit declaration of function
'GetTopTransactionId' [-Wimplicit-function-declaration]
plscheme.c: In function 'parse_trig_args':
plscheme.c:1623:44: error: dereferencing pointer to incomplete type
plscheme.c:1628:38: error: dereferencing pointer to incomplete type
...
(See error.log for details.)

I'm not sure to what degree this is bitrot relating to:
a) Postgres changes
b) Guile changes
but there's doubtless a bit of both.

I'd think it interesting to get this back to working order, whether
it's useful for JavaScript or not.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: deferrable triggers
Next
From: Alvaro Herrera
Date:
Subject: sorting table columns