[erlang-questions] Erlang & PostgreSQL native driver

Daniel Caune daniel.caune@REDACTED
Thu Nov 15 20:35:26 CET 2007


Hi,

I did a small patch on the file pgsql_util.erl to support PostgreSQL function that returns void.  I'm contacting Christian Sunesson to ask him whether he would like to integrate this patch in CVS.

***************
*** 233,238 ****
--- 233,239 ----
        1560 -> bit;
        1562 -> varbit;
        1700 -> numeric;
+       2278 -> void;
        Oid ->
            throw({unknown_oid, Oid})
      end.

Regards,

--
Daniel 


> -----Message d'origine-----
> De : Daniel Caune
> Envoyé : jeudi, novembre 15, 2007 14:06
> À : erlang-questions@REDACTED; pgsql-sql@REDACTED
> Objet : Erlang & PostgreSQL native driver
> 
> Hi,
> 
> We are using Erlang, PostgreSQL 8.2.5, and the Erlang library pgsql
> developed by Christian Sunesson
> (http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/).
> 
> 
> The Erlang library pgsql is easy to use and does the job so far, at least
> for our prototyping phase.  However, this library has a problem with
> stored function that returns nothing such as:
> 
> CREATE OR REPLACE FUNCTION foo()
>   RETURNS void
> AS $$
>   ...
> 
> The problem seems to happen when the Erlang library pgsql tries to decode
> the result value return by the stored function, which is void.  The
> transaction has been successfully committed in database.
> 
> (u@REDACTED)3> pgsql:squery(Connection, "SELECT foo()").
> =ERROR REPORT==== 15-Nov-2007::11:40:25 ===
> Error in process <0.38.0> on node 'u@REDACTED' with exit value:
> {{nocatch,{unknown_oid,2278}},[{pgsql_util,decode_oid,1},{pgsql_util,decod
> e_descs,1},{pgsql_proto,process_squery,1},{pgsql_proto,idle,2}]}
> 
> ** exited: {{nocatch,{unknown_oid,2278}},
>             [{pgsql_util,decode_oid,1},
>              {pgsql_util,decode_descs,1},
>              {pgsql_proto,process_squery,1},
>              {pgsql_proto,idle,2}]} **
> 
> I don't think this is a big issue.  According to the error (unknown_oid),
> I suppose that the pgsql library doesn't support void type yet.  We should
> be able to fix easily the library.
> 
> However, because our prototyping phase is close to the end, we are
> thinking to use another library that would perhaps better fit production
> constraints (pool, etc.).  We have tested the PostgreSQL ODBC driver but
> we have faced some issues on Windows (Unicode, PostgreSQL data type
> support).
> 
> We are interesting in having some feedback from people who use both Erlang
> and PostgreSQL.  Which PostgreSQL driver do you use?  Does someone use the
> PostgreSQL driver from Erlang Consulting?  Are there other native
> PostgreSQL driver?
> 
> Thanks,
> 
> --
> Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgsql_util.erl
Type: application/octet-stream
Size: 9803 bytes
Desc: pgsql_util.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071115/0d270e31/attachment.obj>


More information about the erlang-questions mailing list