[postmodern-devel] Patch: {} syntax for arrays should be inside ''
According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this. -- With Best Regards, Stas.
Stas Boukarev <stassats@gmail.com> writes:
According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this. Well, that was too soon, I forgot to attach the patch itself:
-- With Best Regards, Stas.
Stas Boukarev <stassats@gmail.com> writes:
Stas Boukarev <stassats@gmail.com> writes:
According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this.
Aw, now I hit C-x C-w in the wrong buffer, that's what you get for being in a hurry. Sorry for the noise, here's the patch for real. -- With Best Regards, Stas.
Hi Stas, What happens when, with your patch, you try to pass an array as a query parameter? ($1, etc) I suspect the correct thing to do would be to return T as a second value from to-sql-string (which indicates that the string should be escaped when put into a query), rather than putting quotes into the returned string. Also, do you know what the correct syntax is when the array contains a string containing a single quote? I suspect it should be escaped, which will also be handled by returning a second t value. If you could test this for me, I'd be thankful. Cheers, Marijn
Marijn Haverbeke <marijnh@gmail.com> writes:
Hi Stas,
What happens when, with your patch, you try to pass an array as a query parameter? ($1, etc) I suspect the correct thing to do would be to return T as a second value from to-sql-string (which indicates that the string should be escaped when put into a query), rather than putting quotes into the returned string. Also, do you know what the correct syntax is when the array contains a string containing a single quote? I suspect it should be escaped, which will also be handled by returning a second t value. If you could test this for me, I'd be thankful. Indeed, returning T works in all cases you described. I've attached a corrected patch.
-- With Best Regards, Stas.
Thanks! Pushed to the repository. Best, Marijn
participants (2)
-
Marijn Haverbeke
-
Stas Boukarev