Re: [SQL] Isnumeric function?

2004-09-09 Thread Greg Stark
Theo Galanakis <[EMAIL PROTECTED]> writes: > I created the Index you specified, however it chooses to run a seq scan on > the column rather than a Index scan. How can you force it to use that > Index.. > > CREATE INDEX idx_content_numeric ON botched_table(content) WHERE content ~ > '^[0-9]{1,9}$

Re: [SQL] Isnumeric function?

2004-09-09 Thread Achilleus Mantzios
O Theo Galanakis έγραψε στις Sep 10, 2004 : > > > Josh, > > I agree with the machete technique, unfortunately The structure is inplace > and a work-around was required. > > I created the Index you specified, however it chooses to run a seq scan on > the column rather than a Index scan. How can

Re: [SQL] Isnumeric function?

2004-09-09 Thread sad
On Friday 10 September 2004 04:20, Theo Galanakis wrote: > I was just thinking, wouldn't it be great if the pg community had a site > where anyone could contribute their generic functions, or request for a > particular function. i vote positive. ---(end of broadcast)-

Re: [SQL] Isnumeric function?

2004-09-09 Thread Theo Galanakis
Title: RE: [SQL] Isnumeric function? Josh, I agree with the machete technique, unfortunately The structure is inplace and a work-around was required. I created the Index you specified, however it chooses to run a seq scan on the column rather than a Index scan. How can you force it to use

Re: [SQL] Isnumeric function?

2004-09-09 Thread Josh Berkus
Theo, > I was just thinking, wouldn't it be great if the pg community had a site > where anyone could contribute their generic functions, or request for a > particular function. In theory, this is supposed to be a feature of pgFoundry.org. However, there is a bug in gForge that prevents us fro

Re: [SQL] Isnumeric function?

2004-09-09 Thread Theo Galanakis
Title: RE: [SQL] Isnumeric function? I was just thinking, wouldn't it be great if the pg community had a site where anyone could contribute their generic functions, or request for a particular function. Cold Fusion has a cflib.org, perhaps a pglib.org? -Original Message- From: Jeff

Re: [SQL] Isnumeric function?

2004-09-09 Thread Josh Berkus
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 th

Re: [SQL] Datetime conversion in WHERE clause

2004-09-09 Thread Josh Berkus
Philippe, > Is there a way to force the date conversion to fail sliently, and simply > return a null in case the parameter is not a valid date? You'd need to write a custom function, using an external language that allows you to test for valid date values. I prefer using PL/perlU with Date::M

Re: [SQL] aggregate function stddev

2004-09-09 Thread Josh Berkus
Kemin, > Just noticed that the postgres stddev is the stddev_sample formula. > There are two different ways to calculate this value. > Their difference is very small with large samle size. It would be nice > to distinguish the two different versions. Note sent to PGSQL-DOCS. > I also noticed th

Re: [SQL] Isnumeric function?

2004-09-09 Thread Passynkov, Vadim
How about this CREATE OR REPLACE FUNCTION is_numeric ( text ) RETURNS bool AS ' if { [string is integer $1] || [string is double $1] } { return true } return false ' LANGUAGE 'pltcl' IMMUTABLE; SELECT is_numeric ( '-1' ); is_numeric t (1 row) SELECT is_numeric ( '+1e-1'

[SQL] Datetime conversion in WHERE clause

2004-09-09 Thread Philippe Lang
Hello, I'm converting a varchar to a date in a search routine which looks like: -- CREATE FUNCTION public.search_data(varchar) RETURNS SETOF foo1 AS ' SELECT DISTINCT foo1.* FROM foo1 LEFT JOIN foo2 ON foo2.fk = foo1.pk WHERE lower

Re: [SQL] Isnumeric function?

2004-09-09 Thread Jeff Eckermann
Ok, how about this. At least it works in my testing. I have extended it to allow a negative sign (trailing also), which I would expect to be allowed in a comprehensive "isnumeric" function. If I am wrong, feel free to slap me around; although correcting the regex would be more constructive. ;-)

Re: [SQL] Query Plan

2004-09-09 Thread Richard Huxton
Theo Galanakis wrote: Have a question regarding when a Query Plan uses an Index. I have a basic statement This query uses the Index Scan: explain analyse select * from tablea where columna_id < 57 This query uses Seq Scan: explain analyse select * from tablea where columna_id < 58 There are about 5

[SQL]

2004-09-09 Thread Theo Galanakis
How do you get FTP access to http://developer.postgresql.org/docs/pgsql/contrib/ ftp://developer.postgresql.org/docs/pgsql/contrib/ Asks for a username and password, tried annonymous. Theo __This email, including