Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-16 Thread Klint Gore
On Thu, 13 Oct 2005 16:24:23 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > BTW, another issue here is that if we did merge the first DECLARE with > the scope of auto-declared variables, it would be a non backwards > compatible change. Right now you can do, say, > > declare found int; > > an

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share

2005-10-15 Thread Karl O. Pinc
On 10/14/2005 09:30:51 AM, Michael Fuhr wrote: On Thu, Oct 13, 2005 at 03:51:15PM +, Karl O. Pinc wrote: > I definately do not recall catching any additional errors at > compile time as part of the switch to 8. 8.0's syntax checking is minimal; 8.1's will be better. Looking forward to

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-14 Thread Jim C. Nasby
On Thu, Oct 13, 2005 at 04:24:23PM -0400, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > On Thu, Oct 13, 2005 at 01:30:56PM -0400, Tom Lane wrote: > >> Basically, DECLARE introduces a new name scope that wouldn't be there > >> if you didn't say DECLARE. Without some bizarre reint

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share

2005-10-14 Thread Michael Fuhr
On Thu, Oct 13, 2005 at 03:51:15PM +, Karl O. Pinc wrote: > I definately do not recall catching any additional errors at > compile time as part of the switch to 8. 8.0's syntax checking is minimal; 8.1's will be better. Also, you might not even have plpgsql's lanvalidator function if you rest

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share

2005-10-14 Thread Karl O. Pinc
On 10/13/2005 09:38:36 AM, Bruce Momjian wrote: > Fair enough. At the same time it sure would be nice if > plpgsql actually compiled (and parsed SQL) at > function definition time, even when the result is thrown away. > I'm building a big system and it's quite annoying > to get syntax errors,

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share

2005-10-14 Thread Karl O. Pinc
On 10/13/2005 03:24:23 PM, Tom Lane wrote: "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > On Thu, Oct 13, 2005 at 01:30:56PM -0400, Tom Lane wrote: >> Basically, DECLARE introduces a new name scope that wouldn't be there >> if you didn't say DECLARE. Without some bizarre reinterpretation of the >

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > On Thu, Oct 13, 2005 at 01:30:56PM -0400, Tom Lane wrote: >> Basically, DECLARE introduces a new name scope that wouldn't be there >> if you didn't say DECLARE. Without some bizarre reinterpretation of the >> meaning of a DECLARE at the start of a funct

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Jim C. Nasby
On Thu, Oct 13, 2005 at 01:30:56PM -0400, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > Based on all that, I would certainly be in favor of throwing a warning > > if you over-define something, since 99% of the time it's a mistake. Is > > that possible with the current checking we

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Based on all that, I would certainly be in favor of throwing a warning > if you over-define something, since 99% of the time it's a mistake. Is > that possible with the current checking we do at compile time? Without having looked at the code, I imagine

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Jim C. Nasby
On Thu, Oct 13, 2005 at 10:38:36AM -0400, Bruce Momjian wrote: > Karl O. Pinc wrote: > > > > On 10/12/2005 10:32:20 PM, Bruce Momjian wrote: > >We tend to follow the C conventions, so perhaps we > > > should > > > throw a warning, but I can't think of any cases where we throw a > > > warning >

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Tom Lane
Bruce Momjian writes: > Karl O. Pinc wrote: >> Fair enough. At the same time it sure would be nice if >> plpgsql actually compiled (and parsed SQL) at >> function definition time, even when the result is thrown away. > 8.0 has this improvement: > * Do minimal syntax checking of PL/pgSQL fu

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-13 Thread Bruce Momjian
Karl O. Pinc wrote: > > On 10/12/2005 10:32:20 PM, Bruce Momjian wrote: >We tend to follow the C conventions, so perhaps we > > should > > throw a warning, but I can't think of any cases where we throw a > > warning > > in plpgsql because we compile it once on first call. > > > > I am thinkin

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share

2005-10-13 Thread Karl O. Pinc
On 10/12/2005 10:32:20 PM, Bruce Momjian wrote: We tend to follow the C conventions, so perhaps we should throw a warning, but I can't think of any cases where we throw a warning in plpgsql because we compile it once on first call. I am thinking this falls in the "don't do that" category. F

Re: [BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope

2005-10-12 Thread Bruce Momjian
Interesting. If I define this in C: int x(int y) { char *y; } I get a warning: x.c: In function `x': x.c:3: warning: declaration of `y' shadows a parameter but no error. We tend to follow the C conventions, so perhaps we should throw

[BUGS] BUG #1956: Plpgsql top-level DECLARE does not share scope with CREATE FUNCTION

2005-10-12 Thread Karl O. Pinc
The following bug has been logged online: Bug reference: 1956 Logged by: Karl O. Pinc Email address: [EMAIL PROTECTED] PostgreSQL version: 8.0.3 Operating system: Linux Description:Plpgsql top-level DECLARE does not share scope with CREATE FUNCTION Details: Dependi