Re: [BUGS] plpgsql doesn't check a number of expressions and number of target variables correctly

2012-03-05 Thread Pavel Stehule
2012/3/5 Tom Lane : > Pavel Stehule writes: >> Hello >> I found a plpgsql bug: > >> create or replace function fx() >> returns void as $$ >> declare a int; b int; >> begin >>   select 10,20 into a; >> end; >> $$ language plpgsql; > >> this is bug, or minimally potential source of strange behave. >

Re: [BUGS] plpgsql doesn't check a number of expressions and number of target variables correctly

2012-03-05 Thread Tom Lane
Pavel Stehule writes: > Hello > I found a plpgsql bug: > create or replace function fx() > returns void as $$ > declare a int; b int; > begin > select 10,20 into a; > end; > $$ language plpgsql; > this is bug, or minimally potential source of strange behave. AFAICS this is intentional --- see

[BUGS] plpgsql doesn't check a number of expressions and number of target variables correctly

2012-03-05 Thread Pavel Stehule
Hello I found a plpgsql bug: create or replace function fx() returns void as $$ declare a int; b int; begin select 10,20 into a; end; $$ language plpgsql; this is bug, or minimally potential source of strange behave. Regards Pavel Stehule -- Sent via pgsql-bugs mailing list (pgsql-bugs@pos

Re: [BUGS] plpgsql bug OR future request: Assign fileds in composite subfiled. eg. table.compositefield.subfield := TRUE;

2008-12-10 Thread Oleg Serov
ERROR: syntax error at or near "(" LINE 15:(row_main_table.subtype).flag := FALSE; -- cannot set ^ ** Ошибка ** ERROR: syntax error at or near "(" SQL state: 42601 Характеристика:321 2008/12/10 Pavel Stehule <[EMAIL PROTECTED]>: > Hello > > 2008/12/10 Ole

Re: [BUGS] plpgsql bug OR future request: Assign fileds in composite subfiled. eg. table.compositefield.subfield := TRUE;

2008-12-10 Thread Pavel Stehule
Hello 2008/12/10 Oleg Serov <[EMAIL PROTECTED]>: > SQL: > CREATE TABLE second_type ( >flag BOOLEAN > ); > CREATE TABLE main_type ( >subtype second_type > ); > CREATE OR REPLACE FUNCTION "bug_in_tabletypes" () RETURNS pg_catalog.void AS > $body$ > DECLARE >row_main_table mai

[BUGS] plpgsql bug OR future request: Assign fileds in composite subfiled. eg. table.compositefield.subfield := TRUE;

2008-12-10 Thread Oleg Serov
SQL: CREATE TABLE second_type ( flag BOOLEAN ); CREATE TABLE main_type ( subtype second_type ); CREATE OR REPLACE FUNCTION "bug_in_tabletypes" () RETURNS pg_catalog.void AS $body$ DECLARE row_main_table main_type%rowtype; BEGIN row_main_table.subtype := NULL; -- all

Re: [BUGS] plpgsql functions crash cvs

2006-03-01 Thread Tom Lane
Kris Jurka <[EMAIL PROTECTED]> writes: > eKol in #postgresql reported a problem with a plpgsql function crashing > the server. I tested the attached against 8.2cvs as of this morning > and got this stacktrace: > #0 plpgsql_xact_cb (event=XACT_EVENT_COMMIT, arg=0x0) at pl_exec.c:4521 I believe

Re: [BUGS] plpgsql functions crash cvs

2006-03-01 Thread Alvaro Herrera
Kris Jurka wrote: > > eKol in #postgresql reported a problem with a plpgsql function crashing > the server. I tested the attached against 8.2cvs as of this morning > and got this stacktrace: Interesting. 8.1 also crashes. 8.0 instead gives this output: psql:/home/alvherre/funcs.sql:86: ERRO

[BUGS] plpgsql functions crash cvs

2006-03-01 Thread Kris Jurka
eKol in #postgresql reported a problem with a plpgsql function crashing the server. I tested the attached against 8.2cvs as of this morning and got this stacktrace: #0 plpgsql_xact_cb (event=XACT_EVENT_COMMIT, arg=0x0) at pl_exec.c:4521 #1 0x0046f43d in CallXactCallbacks (event=XAC

Re: [BUGS] plpgsql TEMP table issue not fixed in 8.1?

2005-12-16 Thread Neil Conway
On Thu, 2005-12-15 at 11:09 -0800, Jim Klo wrote: > I’m having a similar problem: > > ERROR: relation with OID 7121526 does not exist > CONTEXT: SQL statement "SELECT * INTO temp tmp_resourcequeue from > resourcequeue where timeblockid in (select timeblockid from tmp_timeblock)" > PL/pgSQL f

Re: [BUGS] plpgsql TEMP table issue not fixed in 8.1?

2005-12-16 Thread Jim Klo
>Folks,> >I'd swear somebody committed a fix for the issue with temp tables inside >plpgsql functions, like, months ago.  Yet I still get: >ERROR:  relation with OID 16607 does not exist>CONTEXT:  SQL statement "INSERT INTO tmp_runs ( run_id, batch, machine ) >VALUES ( NEXTVAL('runs_run_id_se

Re: [BUGS] plpgsql TEMP table issue not fixed in 8.1?

2005-08-31 Thread Tom Lane
Josh Berkus writes: > I'd swear somebody committed a fix for the issue with temp tables inside > plpgsql functions, like, months ago. Nope. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your fr

[BUGS] plpgsql TEMP table issue not fixed in 8.1?

2005-08-31 Thread Josh Berkus
Folks, I'd swear somebody committed a fix for the issue with temp tables inside plpgsql functions, like, months ago. Yet I still get: ERROR: relation with OID 16607 does not exist CONTEXT: SQL statement "INSERT INTO tmp_runs ( run_id, batch, machine ) VALUES ( NEXTVAL('runs_run_id_seq'), $1

[BUGS] plpgsql

2005-04-02 Thread raj kumar
hello,we have a postgres in windows and linux operating systems, then the problemis in plpgsql functions, which is i created a function with exceptionhandling in postgres 8.0.1 (windows operating system) which handle theexceptions very well, but i created the same function in (postgres8.0.1)linux o

Re: [BUGS] plpgsql unreachable code (was BUG #1329: Bug in IF-ELSEIF-ELSE construct)

2004-11-27 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: >> (BTW, another thing this example exposes is that we don't issue warnings >> about trivially-dead-code, such as statements in a basic block that >> follow a RETURN. This would probably be also worth doing.) > Attached is a patch that implements this. Spe

[BUGS] plpgsql unreachable code (was BUG #1329: Bug in IF-ELSEIF-ELSE construct)

2004-11-27 Thread Neil Conway
Neil Conway wrote: (BTW, another thing this example exposes is that we don't issue warnings about trivially-dead-code, such as statements in a basic block that follow a RETURN. This would probably be also worth doing.) Attached is a patch that implements this. Specifically, if there are any stat

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-10-04 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Yeah, this has been on my to-do list for awhile... > Ah, ok. Is this something you want to handle, or should I take a look? Well, it's not *high* on my to-do list; feel free to take a look. >> One question here is whether Oracle's PL/S

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-10-04 Thread Neil Conway
Tom Lane wrote: Yeah, this has been on my to-do list for awhile... Ah, ok. Is this something you want to handle, or should I take a look? One question here is whether Oracle's PL/SQL has a precedent, and if so which way does it point? I did some limited testing of this, and it appears that PL/SQL's

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > ... One way to fix this would be to reimplement EXECUTE to > be essentially `eval': it would take an arbitrary string and execute it > as a PL/pgSQL statement. That would fix the FOUND problem, and also give > us EXECUTE INTO in one fell swoop. Yeah, this

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Neil Conway
On Fri, 2004-10-01 at 13:39, Tom Lane wrote: > Possibly not. Can EXECUTE determine how the executed statement would > have set the flag? At the moment, EXECUTE just feeds the string it finds to spi_execute(). We could probably hack it to figure out how to modify FOUND, but I think it would be ugl

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > On Fri, 2004-10-01 at 02:26, Tom Lane wrote: >> EXECUTE does not set the FOUND flag. > Is there a good reason for this behavior? Possibly not. Can EXECUTE determine how the executed statement would have set the flag? Should we assume that the function d

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Neil Conway
On Fri, 2004-10-01 at 02:26, Tom Lane wrote: > EXECUTE does not set the FOUND flag. Is there a good reason for this behavior? -Neil ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs

Re: [BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Tom Lane
=?koi8-r?B?68/O09TBztTJzg==?= <[EMAIL PROTECTED]> writes: > sql := 'insert into tbl' || suffix::text || ' values (1,1)'; > EXECUTE sql; > IF NOT FOUND THEN > RAISE NOTICE 'NOT INSERTED'; > END IF; EXECUTE does not set the FOUND flag. See http://developer.postgresql.org/docs/postgres/plpgsql-sta

[BUGS] PLPGSQL and FOUND stange behaviour after EXECUTE

2004-09-30 Thread Константин
Hello, FreeBSD, I386, Postgres 8.0.0 beta2 Trying issuing such a plpgsql function: Create function test_fun (suffix char(4)) returns integer as $$ DECLARE sql text; BEGIN sql := 'insert into tbl' || suffix::text || ' values (1,1)'; EXECUTE sql; IF NOT FOUND THEN RAISE NOTICE 'NOT INSERTED'; END I

Re: [BUGS] plpgsql error handling bug

2004-09-05 Thread Gaetano Mendola
Tom Lane wrote: > [EMAIL PROTECTED] writes: > >>I found a bug in the behaviour of plpgsql error handling system >>while trying to handle foreign key violation exception. > > > This is not a bug in the exception system. > > The problem is that FK constraints are enforced by triggers that do not > fi

Re: [BUGS] plpgsql error handling bug

2004-09-05 Thread Tom Lane
[EMAIL PROTECTED] writes: > I found a bug in the behaviour of plpgsql error handling system > while trying to handle foreign key violation exception. This is not a bug in the exception system. The problem is that FK constraints are enforced by triggers that do not fire until the end of the outer

Re: [BUGS] plpgsql error handling bug

2004-09-05 Thread Stephan Szabo
On Sun, 5 Sep 2004 [EMAIL PROTECTED] wrote: > I found a bug in the behaviour of plpgsql error handling system > while trying to handle foreign key violation exception. > > When this error occured, control doesn't jump to exception handling block. > It moves to the next statement instead. When con

[BUGS] plpgsql error handling bug

2004-09-05 Thread Ivan-Sun1
Hello. I found a bug in the behaviour of plpgsql error handling system while trying to handle foreign key violation exception. When this error occured, control doesn't jump to exception handling block. It moves to the next statement instead. When control leaves the function exception is occured.

Re: [BUGS] plpgsql - variable's names conflict with table field

2004-02-17 Thread Pavel Stehule
On Tue, 17 Feb 2004, Tom Lane wrote: > Pavel Stehule <[EMAIL PROTECTED]> writes: > > When I declare variable with same name as field of table, then I > > have a problem with insert cmd in plpgsql procedure. > > Don't do that. > > > Is it plpgsql error or my bug? > > You could argue it eith

Re: [BUGS] plpgsql - variable's names conflict with table field names

2004-02-17 Thread Tom Lane
Pavel Stehule <[EMAIL PROTECTED]> writes: > When I declare variable with same name as field of table, then I > have a problem with insert cmd in plpgsql procedure. Don't do that. > Is it plpgsql error or my bug? You could argue it either way, perhaps, but it's unlikely to get changed. In

[BUGS] plpgsql - variable's names conflict with table field names

2004-02-17 Thread Pavel Stehule
Hello When I declare variable with same name as field of table, then I have a problem with insert cmd in plpgsql procedure. I can't use this name of columns list in insert cmd; I get syntax error. When I use equal names in SELECT cmd, I didn't get error msg, but stored prodedure don't

[BUGS] plpgsql

2003-12-19 Thread Paul Punett
Hi, I want to concatenate a it counter to a string in a loop in plpgsql. DECLARE counter integer := 1; IdSet char : = 'UniqueId' IdForEachRun varchar; BEGIN IdForEachRun := IdSet || counter;(PROBLEM HERE) --Or IdForEachRun := IdSet + counter;(PROBLEM HERE) While condition LOOP Insert into Table

Re: [BUGS] plpgsql Integer Concat To String

2003-12-19 Thread Rich Hall
Convert "counter" into a VARCHAR and coincatinate that to IdSet using th || operator. You cannot concatinate data of differing TYPEs. Rick Puneet Paul wrote: Hi, I want to concatenate a it counter to a string in a loop in plpgsql. DECLARE counter integer := 1; IdSet char : = 'UniqueId' IdForE

Re: [BUGS] plpgsql For SQLQuery Loop Flags Error

2003-12-18 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I get error "missing ".." at end of SQL expression" ... > Can someone help please The problems appear to be in your declare block: > curTrackList char(15) ALIAS for $1; > sliceFile varchar ALIAS for $2; > lmfpLimit integer ALIAS for $3 Y

Re: [BUGS] plpgsql For SQLQuery Loop Flags Error

2003-12-18 Thread Tom Lane
Puneet Paul <[EMAIL PROTECTED]> writes: > DECLARE > curTrackList char(15) ALIAS for $1; > sliceFile varchar ALIAS for $2; > lmfpLimit integer ALIAS for $3 > mTrackDet RECORD; If that's an accurate copy of your function, then the problem is likely the lack of a semicolon on

Re: [BUGS] plpgsql For SQLQuery Loop Flags Error

2003-12-18 Thread Rich Hall
I should play with your code, but I'm lazy. 1) lmfpLimit integer ALIAS for $3 is missing the trailing ";" lmfpLimit integer ALIAS for $3; 2) VARCHAR variables need a length curId varchar; should be curId varchar(100); 3) I have not seen this style of declaration, where the argum

[BUGS] plpgsql Integer Concat To String

2003-12-18 Thread Puneet Paul
Hi, I want to concatenate a it counter to a string in a loop in plpgsql. DECLARE counter integer := 1; IdSet char : = 'UniqueId' IdForEachRun varchar; BEGIN IdForEachRun := IdSet || counter;(PROBLEM HERE) --Or IdForEachRun := IdSet + counter;(PROBLEM HERE) While condition LOOP Insert into Table

[BUGS] plpgsql For SQLQuery Loop Flags Error

2003-12-18 Thread Puneet Paul
Hi All, I am compiling a function that uses the For Query loopEnd Loop. I get error "missing ".." at end of SQL expression" I have read following Note: The PL/pgSQL parser presently distinguishes the two kinds of FOR loops (integer or query result) by checking whether the target variable men

Re: [BUGS] plpgsql does not close cursors when a block ends

2003-11-13 Thread Bruce Momjian
Marcel Gsteiger wrote: > I created a plpgsql function declaring and then using a cursor. > After opening and using this cursor, I forgot to close it. Now > when the function terminates, this cursor remains open. Then, > when I call the function again with other parameters, the OPEN > CURSOR compl

[BUGS] plpgsql does not close cursors when a block ends

2003-11-13 Thread Marcel Gsteiger
Hi, Please find enclosed my description of what I think is probably a bug in plpgsql. Keep up the good work, this is a wonderful product. Best regards Marcel Gsteiger Milprog AG 3001 Berne Switzerland Freundliche Grüsse Milprog AG Marcel Gsteiger bug.template Description: Binary data BEGIN:VC

[BUGS] plPGSQL bug in function creation

2003-09-08 Thread Marek Lewczuk
Hello, I think that there is a bug in plPGSQL - or maybe I don't know something about this language. Try to create this function Ok., this is the function created in plPGSQL: CREATE FUNCTION "public"."test" (text, text) RETURNS text AS' BEGIN IF $1 THEN RETURN $1; ELSE RETURN $2; E

[BUGS] plpgsql function behaves strange

2002-06-01 Thread Christian Zagrodnick
see attachment -- Christian Zagrodnick gocept gmbh & co. kg - schalaunische strasse 6 - 06366 koethen/anhalt fon. +49 3496 3099114 fax. +49 3496 3099118 mob. +49 173 9078826 mail [EMAIL PROTECTED] If PostgreSQL failed to compile on your computer or you found a bug that is likely to be speci

[BUGS] plpgsql function behaves strange

2002-05-28 Thread Christian Zagrodnick
see attachment -- Christian Zagrodnick gocept gmbh & co. kg - schalaunische strasse 6 - 06366 koethen/anhalt fon. +49 3496 3099114 fax. +49 3496 3099118 mob. +49 173 9078826 mail [EMAIL PROTECTED] If PostgreSQL failed to compile on your computer or you found a bug that is likely to be speci

Re: [BUGS] (plpgsql) DECLARE foo NUMERIC(5,2): syntax error at "("

2002-02-21 Thread Tom Lane
Angus Lees <[EMAIL PROTECTED]> writes: > from a quick look at plpgsql/src/gram.y, the decl_dtypename rule > only allows type modifiers (decl_attypmod) on CHAR, VARCHAR or BPCHAR. This is fixed in 7.2. regards, tom lane ---(end of broadcast)---

[BUGS] (plpgsql) DECLARE foo NUMERIC(5,2): syntax error at "("

2002-02-21 Thread Angus Lees
PL/pgSQL docs say "PL/pgSQL variables can have any SQL datatype". but when i try: CREATE FUNCTION foo() RETURNS NUMERIC(5,2) AS ' DECLARE bar NUMERIC(5,2); BEGIN bar := 123.45; return bar; END; ' LANGUAGE 'plpgsql'; then "select foo()" gives: NOTICE: plpgsql: ERROR dur

Re: [BUGS] plpgsql support

2002-02-01 Thread Stephan Szabo
On Tue, 29 Jan 2002, Nagasubramanya L wrote: > I have even tried > CREATE LANGUAGE 'plpgsql' > > But I am not able to set it. What is that I should do to set up this language >support. Use the shell script createlang createlang plpgsql should add it to the database in question.

[BUGS] plpgsql support

2002-02-01 Thread Nagasubramanya L
hello sir,    I have written a function. The language used is sql. I am not getting error if I assign an alias to a variable or if I try to declare any of the variable. I could figure out that I require support if plpgsql, but I am not able to get the suppor of this language. I have tried  

Re: [BUGS] plpgsql & temp table -bug

2001-09-13 Thread Peter Eisentraut
Szima Gabor writes: > Table-OID are cached and not flushed after DROP TABLE? Something like that, but what are you expecting? -- Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/~peter ---(end of broadcast)--- TIP 2: you can ge

[BUGS] plpgsql & temp table -bug

2001-09-13 Thread Szima Gabor
Hello! - > createdb test CREATE DATABASE > createlang plpgsql test > psql test Welcome to psql, the PostgreSQL interactive terminal. create function testcnt () returns int4 as ' declare rp int4; begin select count(*) into rp from test

Re: [BUGS] plpgsql function error after alter table add

2000-12-12 Thread Hiroshi Inoue
Tom Lane wrote: > > "Tim Dunnington" <[EMAIL PROTECTED]> writes: > > If you create a function with a table as the argument, and later alter that > > table and add a new column, the function fails saying "incorrect number of > > attributes for table _tablename_" Dropping and readding the function

Re: [BUGS] plpgsql function error after alter table add

2000-12-12 Thread Tom Lane
"Tim Dunnington" <[EMAIL PROTECTED]> writes: > If you create a function with a table as the argument, and later alter that > table and add a new column, the function fails saying "incorrect number of > attributes for table _tablename_" Dropping and readding the function does > not fix this pro

[BUGS] plpgsql function error after alter table add

2000-12-12 Thread Tim Dunnington
NOTE: Please retract similar, earlier entry (hit send by mistake :-) Synopsis: If you create a function with a table as the argument, and later alter that table and add a new column, the function fails saying "incorrect number of attributes for table _tablename_" Dropping and readding the f