[SQL] Query Plan

2004-09-08 Thread Theo Galanakis
Title: Query Plan 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 a

Re: [SQL] Isnumeric function?

2004-09-08 Thread Greg Stark
Theo Galanakis <[EMAIL PROTECTED]> writes: > error: btree item size 2744 exceeds maximum 2713. > > I assume I had to change some server settings to extend the maximum, however I would guess the block size. But I'm just guessing. > in the end this column holds content, and even applying a

Re: [SQL] Isnumeric function?

2004-09-08 Thread Thomas Swan
Oliver Elphick wrote: On Wed, 2004-09-08 at 18:48, Josh Berkus wrote: Theo, Oliver, Any reason why you don't like ~ '^([0-9]?)+\.?[0-9]*$' ? Yes, because it also matches "." , which is not a valid numeric value. ~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$' Ah, the brut

[SQL] check for circular references in a 2-table heirachy

2004-09-08 Thread Terence Kearns
Does anyone know how I could check to ensure circular references are no created in my 2 table heirachy structure? Here are the tables albums album_relations ++ +-+ | album_id | | parent_album_id | | title | | child_album_id | +-

Re: [SQL] Isnumeric function?

2004-09-08 Thread Theo Galanakis
Title: RE: [SQL] Isnumeric function? Thanks Tom, Actually I did not attach the latest function, I did have a limit of 9 numerical characters, found that out when I applied the update to move all current numerical values to that column. Theo -Original Message- From: Tom Lane [mailto

Re: [SQL] Isnumeric function?

2004-09-08 Thread Tom Lane
Theo Galanakis <[EMAIL PROTECTED]> writes: > So I came up with the following. A Insert/update trigger would call a > procedure to check to see if the content is numeric(a whole number), if so > would update an indexed integer column called (content_numeric). Which would > be the base column to sear

Re: [SQL] Isnumeric function?

2004-09-08 Thread Theo Galanakis
Title: RE: [SQL] Isnumeric function? Thankyou all for your feedback. I actually only want to check for whole numbers, so the ~ '^[0-9]+$' _expression_ is good. The issue really is that our CMS system sometimes holds the value of primary keys within a "content" varchar column(don't ask!), whic

[SQL] aggregate function stddev

2004-09-08 Thread Kemin Zhou
Implementers: 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. I also noticed that oracle has stddev_sampl

Re: [SQL] Isnumeric function?

2004-09-08 Thread Oliver Elphick
On Wed, 2004-09-08 at 18:48, Josh Berkus wrote: > Theo, Oliver, > > > Any reason why you don't like ~ '^([0-9]?)+\.?[0-9]*$' ? > > Yes, because it also matches "." , which is not a valid numeric value. > > > ~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$' > > Ah, the brute force approach ;-)

Re: [SQL] Isnumeric function?

2004-09-08 Thread Josh Berkus
Theo, Oliver, > Any reason why you don't like ~ '^([0-9]?)+\.?[0-9]*$' ? Yes, because it also matches "." , which is not a valid numeric value. > ~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$' Ah, the brute force approach ;-) Actually, the above could be written: ~ '^([0-9]+)|([0-9]*\\.[0-9

Re: [SQL] Isnumeric function?

2004-09-08 Thread Oliver Elphick
On Wed, 2004-09-08 at 17:47, Josh Berkus wrote: > Oliver, Theo: > > > ~ '^[0-9]+$' > > Actually, I usually do: > > ~ '^[0-9]+\.?[0-9]*$' > > ... to include decimals. However, the above assumes that there is at least a > "0" before the decimal; it would be nice to adapt it to matching a lead

Re: [SQL] How to rename a constraint/trigger??

2004-09-08 Thread Josh Berkus
Andrei, > I have a database, where in the tables I have around 100 constrains (link > to other tables) that don't have a name "" or they have a name > like "$1" "$2". Now, I have a module which bases on the same structure, but > I get some query errors from a "" constraint. I really don't know > e

Re: [SQL] Isnumeric function?

2004-09-08 Thread Josh Berkus
Oliver, Theo: > ~ '^[0-9]+$' Actually, I usually do: ~ '^[0-9]+\.?[0-9]*$' ... to include decimals. However, the above assumes that there is at least a "0" before the decimal; it would be nice to adapt it to matching a leading decimal (i.e. .057 ) as well. Can't see any easy way, though