Re: Isnumeric function? - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Isnumeric function?
Date
Msg-id 200409091146.14444.josh@agliodbs.com
Whole thread Raw
In response to Re: Isnumeric function?  (Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>)
List pgsql-sql
Theo,

> Does anyone have any better suggestions???

Well, one suggestion would be to take a machete to your application.  Putting 
key references and text data in the same column?   Sheesh.

If that's not an option, in addition to the approach you've taken, you could 
also do a partial index on the appropriate numeric values:

CREATE INDEX idx_content_numeric ON botched_table(content)
WHERE content ~ '^[0-9]{1,9}$';

However, this approach may be more/less effective that the segregation 
approach you've already taken.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Datetime conversion in WHERE clause
Next
From: Theo Galanakis
Date:
Subject: Re: Isnumeric function?