[SQL] left join in cursor

2003-06-10 Thread Alexey Dashevsky
Hi. Exists too tables (PostgreSQL 7.2.3): a ("cl" integer primary key, a1, a2, ...) - 10 records; b ("cl" integer primary key, b1, b2, ...) - 800 records. BEGIN; DECLARE "c" SCROLL CURSOR FOR select a.*,r.b1 as rb1 from a left join b using (cl) order by a.cl; FETCH FORWARD 100 in "c";

Re: [SQL] Retype

2003-06-10 Thread Richard Huxton
On Monday 09 Jun 2003 10:24 am, Rado Petrik wrote: > I have query " SELECT id_user FROM user WHERE (freg_u & 2 ) > 0 ". > > freg_u is type smallint. > How I retype freg_u to interger ? ... WHERE (freg_u::integer & 2) ... Or you could use the more standard but long-winded CAST function -- Ric

Re: [SQL] how to determine array size

2003-06-10 Thread Achilleus Mantzios
On Mon, 9 Jun 2003, Forest Wilkinson wrote: > I need to enumerate the constraints on any given column in a table, so > I'm examining pg_constraint to get the relevant information. The > conkey array contains a list of constrained columns, and although I am > able to check conkey[1] for constraint

Re: [SQL] Coalesce/Join/Entries may not exist.

2003-06-10 Thread Rod Taylor
On Mon, 2003-06-09 at 08:00, James Taylor wrote: > I've got three tables, I'll shorten the columns down just so you get the > idea: > > lists > --- > id|order_id > > list_results > > id|lid|total > > orders > > id|max > > All of the columns are int's. What I'm

Re: [SQL] how to determine array size

2003-06-10 Thread Rod Taylor
On Mon, 2003-06-09 at 16:23, Forest Wilkinson wrote: > I need to enumerate the constraints on any given column in a table, so > I'm examining pg_constraint to get the relevant information. The > conkey array contains a list of constrained columns, and although I am > able to check conkey[1] for co

Re: [SQL] left join in cursor

2003-06-10 Thread Tom Lane
Alexey Dashevsky <[EMAIL PROTECTED]> writes: > DECLARE "c" SCROLL CURSOR FOR select a.*,r.b1 as rb1 from a left join b using > (cl) order by a.cl; > FETCH FORWARD 100 in "c"; > FETCH FORWARD 100 in "c"; > MOVE -200 in "c"; > [ core dump ] Some plan node types don't cope very well with being run b

Re: [SQL] "Join" on delimeter aggregate query

2003-06-10 Thread Bruno Wolff III
On Mon, Jun 09, 2003 at 10:35:10 +0200, Eivind Kvedalen <[EMAIL PROTECTED]> wrote: > > Ok. What I actually had in mind was whether the optimizer would remove the > ORDER BY clause completely or not, as it isn't used in the top-level > SELECT query, and SQL doesn't in general guarantee ordered ro

[SQL] trigger error

2003-06-10 Thread Yudie
Hi, I',m trying to create trigger with plpgsql trigger function then I got this error message when trigger executed:   Number: -2147467259 Error while executing th query; ERROR: fmgr_info: function 1546856080: cache lookup failed   Here is the function code:   CREATE FUNCTION TRIGGER_UPDATE_

Re: [SQL] trigger error

2003-06-10 Thread Dmitry Tkach
You must have dropped and recreated the function after your trigger was created... You need to recreate the trigger now, so that it picks up the new function id. In the future use 'CREATE OR REPLACE' to modify a function instead of DROP and CREATE - this will make sure the modified function keep

Re: [SQL] trigger error

2003-06-10 Thread Mendola Gaetano
"Yudie" <[EMAIL PROTECTED]> wrote: > Hi, > I',m trying to create trigger with plpgsql trigger function > then I got this error message when trigger executed: > Number: -2147467259 > Error while executing th query; > ERROR: fmgr_info: function 1546856080: cache lookup failed > Here is the function

Re: [SQL] how to determine array size

2003-06-10 Thread Forest Wilkinson
>> I need to enumerate the constraints on any given column in a table, so >> I'm examining pg_constraint to get the relevant information. The >> conkey array contains a list of constrained columns, and although I am >> able to check conkey[1] for constraints on a single column, I would >> like to

Re: [SQL] how to determine array size

2003-06-10 Thread Rod Taylor
> Is pg_get_constraintdef() documented somewhere? I'd like to know it's > arguments, return format, and whether it will be supported in future > postgres releases. Support for it will improve, and it'll be around for a few releases anyway. > >From what I see in pg_dump.c, it appears to accept