[SQL] Trigger cant find function

2000-11-14 Thread Graham Vickrage
I seem to be having difficulty creating a trigger. I have creted the function and tested it which seems to work fine: - CREATE FUNCTION get_prod_cost_price (varchar, int8) RETURNS float AS ' DECLARE cost FLOAT; BEGIN SELECT cost_price INTO cost FROM product WHERE code = $1;

Re: [SQL] Trigger cant find function

2000-11-14 Thread Tom Lane
"Graham Vickrage" <[EMAIL PROTECTED]> writes: > ERROR: CreateTrigger: function get_prod_cost_price() does not exist > It is clear that it does exist so why does the trigger creation code not > find it? Because the code is looking for a function of no arguments, which yours is not. The method fo

Re: [SQL] Using a postgres table to maintain unique id?

2000-11-14 Thread Thomas Swan
At 11/13/2000 06:22 PM -0800, Michael Teter wrote: > Can someone show me how to create (and use) an int8 > sequence? From what I can tell (both from docs and doing a describe on sequences in my database), a postgresql sequence is an int4, not an int8, and thus you are limited to a max of 2.1 bil

Re: [SQL] how to continue a transaction after an error?

2000-11-14 Thread Stephan Szabo
On Tue, 14 Nov 2000, Philip Warner wrote: > >I could > >almost see certain recoverable internal state things being worth not doing > >a rollback for, but not constraints. > > Not true, eg, for FK constraints. The solution may be simple and the > application needs the option to fix it. Also, eg,

Re: [SQL] Using a postgres table to maintain unique id?

2000-11-14 Thread Steve Wampler
Thomas Swan wrote: > > At 11/13/2000 06:22 PM -0800, Michael Teter wrote: > > > > From what I can tell (both from docs and doing a > > describe on sequences in my database), a postgresql > > sequence is an int4, not an int8, and thus you are > > limited to a max of 2.1 billion values. > > > > If

[SQL] Using Array-Values in subselect

2000-11-14 Thread Alvar Freude
Hi, i want to create a linked structure of values. Each text has an id, an array of children ids and the value itself. CREATE TABLE structure ( id int8, children int8[], value text ); Now i want to select all values which are connected to a given parent #x at once. My firs

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Roberto Mello
Alvar Freude wrote: > > Hi, > > i want to create a linked structure of values. Each text has an id, an > array of children ids and the value itself. Looks like you want something similar to Oracle's CONNECT BY statement. There are some solutions to that. At OpenACS we had to deal with t

RE: [SQL] Using Array-Values in subselect

2000-11-14 Thread Edmar Wiggers
IMHO you should use another table instead of an array. Forget about reasonable speed when using IN sub-queries, you'll get a sequential scan of the sub-query for every row in the master select. I've heard the EXISTS operator provides far better performance. In 7.1, there's a very nice solution:

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Alvar Freude
Roberto Mello schrieb: > Looks like you want something similar to Oracle's CONNECT BY statement. > There are some solutions to that. At OpenACS we had to deal with that so > implemented something like what you described here. > However, the methods described by Joe Celko is his boo

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Stephan Szabo
If you look in contrib of the source, there is a set of array operators(functions) including element in set. That'll probably do what you want (you don't do an in actually, it'll be like ) On Tue, 14 Nov 2000, Alvar Freude wrote: > Roberto Mello schrieb: > > Looks like you want someth

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > If you look in contrib of the source, there is a set of > array operators(functions) including element in set. > That'll probably do what you want (you don't do an in > actually, it'll be like ) The array stuff is pretty simplistic at the moment, and

[SQL] FTI, paged, ranked searching and efficiency.

2000-11-14 Thread Paul
Hello, This is going to be a bit long, I hope some of you will take the trouble to read it :) I am building a search engine for a section of a (PHP based) website. I wish the user to be able to a number of words in the search, and the search results to be ranked by the number of times words occu

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Alvar Freude
Tom Lane schrieb: > > The array stuff is pretty simplistic at the moment, and could be taken > a lot further if there were someone who wanted to work on it. > (hint hint) :) If i had time, this would be interesting, but I think my C experiences are not very good and some years old (I like much