Re: [PROPOSAL] DML value format

Поиск
Список
Период
Сортировка
От Osvaldo Rosario Kussama
Тема Re: [PROPOSAL] DML value format
Дата
Msg-id 46C084F4.6080202@yahoo.com.br
обсуждение исходный текст
Ответ на [PROPOSAL] DML value format  (Alejandro Torras <atec_post@yahoo.es>)
Ответы Re: [PROPOSAL] DML value format  (Michael Glaesemann <grzm@seespotcode.net>)
Список 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 по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: can i use an array as a table (in the from clause)
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: [PROPOSAL] DML value format