Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Regular Expression Data Type


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Richard Doust <rdoust(at)mac(dot)com>
  • Cc: pgsql-general(at)postgresql(dot)org
  • Subject: Re: Regular Expression Data Type
  • Date: Sat, 21 Apr 2007 12:29:57 -0400
  • Message-id: <24675(dot)1177172997(at)sss(dot)pgh(dot)pa(dot)us>

Richard Doust <rdoust(at)mac(dot)com> writes:
> What I'd like to be able to do is to define a field in the database  
> as a regular expression so that when I select, i.e.,

> select price from shipping_prices where shipFromZip = '23773' and  
> shipToZip ~ '87927'

> because shipToZip is defined as a regular expression, I'd match a row  
> where shipToZip held the value '879[0-9]{2,2}' or '87[0-9]*'.

I don't see the problem ... you just write a variable instead of a
constant on the right-hand side of ~, no?

How efficient this might be is another question, but it works.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group