Re: [PROPOSAL] DML value format - Mailing list pgsql-general

From Osvaldo Rosario Kussama
Subject Re: [PROPOSAL] DML value format
Date
Msg-id 46C084F4.6080202@yahoo.com.br
Whole thread Raw
In response to [PROPOSAL] DML value format  (Alejandro Torras <atec_post@yahoo.es>)
Responses Re: [PROPOSAL] DML value format  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
Alejandro Torras escreveu:
> -- English --
> Hi,
>
> Is there some way to put values in a INSERT statement
> without taking care of apostrophes?
>
> In example:
> INSERT INTO persons VALUES ('Harry', 'O'Callaghan');
>                                       ^^^^^^^^^^^
>
> I think that it can be used some kind of length-marker
> to help the parsing of the value.
>
> In example:
> INSERT INTO persons VALUES ('Harry', @11:O'Callaghan);
>
> I think this approach could help reducing the sql
> injections.
>
> Regards,
> A. Torras.
>
> -- Castellano --
> Hola,
>
> ¿Hay alguna manera de insertar valores en una
> sentencia INSERT sin tener en cuenta apóstrofes?
>
> Por ejemplo:
> INSERT INTO persons VALUES ('Harry', 'O'Callaghan');
>                                       ^^^^^^^^^^^
>
> Pienso que puede ser usado algún tipo de marcador de
> longitud para ayudar el parseo del valor.
>
> Por ejemplo:
> INSERT INTO persons VALUES ('Harry', @11:O'Callaghan);
>
> Creo que este enfoque podría ayudar reduciendo las
> inyecciones SQL (SQL injections).
>


Dollar-Quoted String Constants?
http://www.postgresql.org/docs/8.2/interactive/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

INSERT INTO persons VALUES ($$Harry$$, $$O'Callaghan$$);

Perhaps use quote_literal() function?
http://www.postgresql.org/docs/8.2/interactive/functions-string.html

Osvaldo

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: can i use an array as a table (in the from clause)
Next
From: Michael Glaesemann
Date:
Subject: Re: [PROPOSAL] DML value format