[postmodern-devel] one-way array/record/coercion support
Daniel Janus
dj at danieljanus.pl
Sat Mar 6 22:37:17 UTC 2010
Hi Marijn,
> Thanks for the code. However, :coerce is already there, named :type,
Didn't notice it -- thanks!
> and the way to-sql-string is currently used, it should A) not use
> S-SQL functions, since cl-postgres does not depend on S-SQL,
Then S-SQL could contain a method TO-SQL-STRING specializing on vectors
and lists, much the same way as it now contains a specialization on
symbols (see s-sql.lisp, lines 263-264).
> , and B)
> serialise to a format that can also be used to pass parameters to
> prepared queries. I'm not that knowledgeable about Postgres' textual
> formats, but it appears that a value like ARRAY[1, 2, 3] can not be
> written as a parameter:
>
> Database error 22P02: array value must start with "{" or dimension
> information
Could you elaborate on how you are getting this error? I don't seem
to have problems when passing arrays to prepared statements in this
way:
weekword=# prepare testme(int[]) as select array_lower($1, 1) as lo,
array_upper($1, 1) as hi;
PREPARE
weekword=# execute testme(array[1,2,3]);
lo | hi
----+----
1 | 3
> If you feel like getting to the bottom of this, feel free to submit an
> alternative patch. If not, array serialisation will have to wait a bit
> more.
Thanks for the comments! I'll try to do my best to work this out in a
correct way.
Best,
Daniel
More information about the postmodern-devel
mailing list