Re: text column constraint, newbie question

From: RebeccaJ <rebeccaj(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: text column constraint, newbie question
Date: 2009-03-22 17:36:37
Message-ID: 25e6b4a4-201c-4c2e-b066-18e08d1880e9@u9g2000pre.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > Are there characters, maybe non-printing characters, or perhaps
> > even whole phrases, that could cause problems in my database or
> > application if I were to allow users to enter them into that column?
>
> > If so, does anyone happen to have a regular expression handy that you
> > think is a good choice for text columns' CHECK constraint? Or maybe a
> > link to a discussion of this topic?
>
> Nope, there's nothing you can put into a text to break pgsql.
> However, if you are using regular old queries, you'd be advised to use
> pg_escape_string() function in php to prevent SQL injection attacks.

Thanks! I'll check out pg_escape_string() in php, and I see that
PostgreSQL also has something called PQescapeStringConn... I wonder if
I should use both...

Also, I should have asked: what about char and varchar fields? Can
those also handle any characters, as long as I consider SQL injection
attacks?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben Ali Rachid 2009-03-22 17:52:25 Re: Srf function : missing library on PostgreSQL 8.3.6 on Windows?
Previous Message Tom Lane 2009-03-22 16:57:05 Re: Srf function : missing library on PostgreSQL 8.3.6 on Windows?