[SQL] Recursive select

2001-05-23 Thread Martin Smetak
Hi all! Anyone know if it's possible to make a recursive select from a table ? My problem: I got a table of "some categories" which all points to its parrent one(tree)...shown below. And I want to select all names of parrent categories of one child, lets say "fast[4]". Now I'm solving that with

Re: [SQL] Select question

2001-05-23 Thread Stephan Szabo
I'm not sure, but... Does it work if you say cdate '2001-05-18' ? (Possibly ::date too) I'd guess your date value you're trying to put there is getting treated as an integer expression. On Wed, 23 May 2001, Chris Ruprecht wrote: Hi all, although not new to databases, I'm new to the

Re: [SQL] Select question

2001-05-23 Thread Tom Lane
Chris Ruprecht [EMAIL PROTECTED] writes: phone=# select * from phonelog where cdate 2001-05-18 order by cdate limit 2 ; Try select * from phonelog where cdate '2001-05-18' order by cdate limit 2 I think it's interpreting your query as where cdate 1978 (result of integer subexpression) and

Re: [SQL] index/join madness

2001-05-23 Thread Tom Lane
Michael Richards [EMAIL PROTECTED] writes: [ a severely incomplete problem description ] Table schema? Full text of the query? It has one index defined on: Index formdata_pkey Attribute | Type ---+- formid| integer occid | integer userid| integer

Re: [SQL] Why indexes are not used when scanning from functions?

2001-05-23 Thread Tom Lane
=?KOI8-R?B?IuzP19DB3sUg4crEwc3J0iI=?= [EMAIL PROTECTED] writes: create function get_fio1(text) returns varchar as 'select fio from patient_temp where fio like $1::text || \'%\';' language 'sql'; You won't get an indexscan for this because the LIKE pattern is not a constant at planning time,

[SQL] where's ALTER TABLE table DROP [ COLUMN ] column???

2001-05-23 Thread Bruno Boettcher
Hello! just trying to write an upgrade script for my bookkeeping system and noticed that it seems that i can't throw out the legacy stuff accumulated over time as far as i can tell, i can add columns to a table, but can't remove them later on. is this true? any easy way to