Re: [SQL] indexing and LIKE

2001-10-12 Thread Tom Lane
Patrik Kudo <[EMAIL PROTECTED]> writes: > Thanks for your respons, but I'm afraid it didn't help. I've succeeded > with indexing my table using functional indices, but the problem is that > the index I create won't work with my query. Works for me: test71=# create table person (last_name text);

[SQL] DROP VIEWS

2001-10-12 Thread Oleg Lebedev
Hi, I am trying to drop a view 'activity_IP' (notice that last two letters are capitalized), but get an exception saying: ERROR: view "activity_ip" does not exist Here, the last two letters are lower-case. There is an entry in pg_views table for view 'activity_IP', but not for 'activity_ip'. How c

Re: [SQL] select 5/2???

2001-10-12 Thread Szabo Zoltan
Which postgres version? in PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC 2.96 : db=> select -5./2.; ?column? -- -2.5 (1 row) CoL BELLON Michel wrote: > The good select is > > SELECT 5./2. > > BUT > > select -5./2. > +--+ > | ?column? | > +--+ >

[SQL] MEDIAN as custom aggregate?

2001-10-12 Thread Josh Berkus
Folks, Hey, anybody have a custom aggregate for median calucation? I'm doing this through a PL/pgSQL function, and a custom aggregate would probably be faster. For those whose stats terminology is rusty, the "median" is the "middle" value in a distribution. For example, if we had the following

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two attributes on

2001-10-12 Thread Lee Harr
> I was looking for a solution on how to write a constraint into a ' create > table ' expression that would ensure that one ' TIME ' attribute value > called arrival_time (declared as TIME) is allways constrained to have a > value that ensures it is allways after another attribute value called > d

Re: [SQL] indexing and LIKE

2001-10-12 Thread Stephan Szabo
On Fri, 12 Oct 2001, Patrik Kudo wrote: > kudo=# select version(); >version > -- > PostgreSQL 7.1.3 on i386--freebsd4.3, compiled by GCC 2.95.3 > (1 row) > > kudo=# create index person_lower_lname_idx on per

Re: [SQL] MEDIAN as custom aggregate?

2001-10-12 Thread Allan Engelhardt
Can't you do something like select age from ages order by age limit 1 offset (select count(*) from ages)/2; except you can't nest the select so you'll have to use a variable to hold it... Make sure it does the right thing when there is an odd number of rows. I don't understand why you want th

Re: [SQL] MEDIAN as custom aggregate?

2001-10-12 Thread Josh Berkus
Allan, > Can't you do something like > > select age from ages order by age limit 1 offset (select count(*) > from ages)/2; > > except you can't nest the select so you'll have to use a variable to > hold it... > > Make sure it does the right thing when there is an odd number of > rows. Duu

[SQL] Indexes

2001-10-12 Thread Aasmund Midttun Godal
Can someone shed some light on as to how the indexes actually work? I want to index the results of a function, the function does a whole lot of different selects on different tables. Will the database know when to update the index. If there already is some documentation on this (besides the sou

[SQL] GROUPING

2001-10-12 Thread Timothy J Hitchens
It's been a while since I used postgresql but today I have converted one of my web apps but with one small problem. I goto do a group as designed and executed in mysql and I get told that this and this must be part of the aggreate etc I am puzzled and wonder if someone could bring me up to stratc

Re: [SQL] DROP VIEWS

2001-10-12 Thread Stephan Szabo
You'll need to double quote the name, "activity_IP" On Fri, 12 Oct 2001, Oleg Lebedev wrote: > Hi, > I am trying to drop a view 'activity_IP' (notice that last two letters > are capitalized), but get an exception saying: > ERROR: view "activity_ip" does not exist > Here, the last two letters ar

Re: [SQL] Indexes

2001-10-12 Thread Stephan Szabo
On Fri, 12 Oct 2001, Aasmund Midttun Godal wrote: > Can someone shed some light on as to how the indexes actually work? > > I want to index the results of a function, the function does a whole > lot of different selects on different tables. Will the database know > when to update the index. AFA