Re: [PROPOSAL] DML value format

From: Osvaldo Rosario Kussama <osvaldo_kussama(at)yahoo(dot)com(dot)br>
To: Alejandro Torras <atec_post(at)yahoo(dot)es>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [PROPOSAL] DML value format
Date: 2007-08-13 16:21:08
Message-ID: 46C084F4.6080202@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-13 16:28:11 Re: [PROPOSAL] DML value format
Previous Message Michael Glaesemann 2007-08-13 16:08:51 Re: can i use an array as a table (in the from clause)