BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

Поиск
Список
Период
Сортировка
Искать

BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
"Timothy Madden" <terminatorul@gmail.com>
Дата:
The following bug has been logged online:

Bug reference:      5136
Logged by:          Timothy Madden
Email address:      terminatorul@gmail.com
PostgreSQL version: 8.4.1
Operating system:   Ubuntu
Description:        Please drop the string literal syntax for CREATE
FUNCTION ...
Details: 

Can the string literal syntax for CREATE FUNCTION please, please be dropped
... ?

http://www.postgresql.org/docs/8.4/interactive/plpgsql-structure.html

It is not ANSI/ISO and so annoying for compatibility.

Thank you,
Timothy Madden

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
On lör, 2009-10-24 at 14:01 +0000, Timothy Madden wrote:
> Can the string literal syntax for CREATE FUNCTION please, please be dropped
> ... ?
> 
> http://www.postgresql.org/docs/8.4/interactive/plpgsql-structure.html
> 
> It is not ANSI/ISO and so annoying for compatibility.

Whatever is inside the string literal is also not ANSI/ISO, so why would
it make a difference?

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Timothy Madden <terminatorul@gmail.com>
Дата:
On Sun, Oct 25, 2009 at 12:42 PM, Peter Eisentraut  wrote:

> On l=F6r, 2009-10-24 at 14:01 +0000, Timothy Madden wrote:
> > Can the string literal syntax for CREATE FUNCTION please, please be
> dropped
> > ... ?
>
[...]

> > It is not ANSI/ISO and so annoying for compatibility.
>
> Whatever is inside the string literal is also not ANSI/ISO, so why would
> it make a difference?
>
> At least the function declaration syntax would be right. I think it would
be an important difference; this string literal idea is so strange and
unnatural ...

And why the function body would not be standard ? Do you mean it can never
be for some reason ? How about a simple function ?

Thank you,
Timothy Madden

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
2009/10/25 Timothy Madden :
>
>
> On Sun, Oct 25, 2009 at 12:42 PM, Peter Eisentraut  wrot=
e:
>>
>> On l=C3=B6r, 2009-10-24 at 14:01 +0000, Timothy Madden wrote:
>> > Can the string literal syntax for CREATE FUNCTION please, please be
>> > dropped
>> > ... ?
>
> [...]
>>
>> > It is not ANSI/ISO and so annoying for compatibility.
>>
>> Whatever is inside the string literal is also not ANSI/ISO, so why would
>> it make a difference?
>>
> At least the function declaration syntax would be right. I think it would=
 be
> an important difference; this string literal idea is so strange and
> unnatural ...
>
> And why the function body would not be standard ?

Because standard knows only SQL/PSM language for SQL procedures.
Others databases support only one language for sql procedures (PL/SQL,
T-SQL). But PostgreSQL supports plpgsql, plperl, plpython as sql
procedures - and I am sure, so standard doesnt calculate with
multilangual environments.

Regards
Pavel Stehule

Do you mean it can never
> be for some reason ? How about a simple function ?
>
> Thank you,
> Timothy Madden
>

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Timothy Madden <terminatorul@gmail.com>
Дата:
On Sun, Oct 25, 2009 at 6:17 PM, Pavel Stehule wro=
te:

> 2009/10/25 Timothy Madden :
> >
> >
> > On Sun, Oct 25, 2009 at 12:42 PM, Peter Eisentraut 
> wrote:
> >>
> >> On l=F6r, 2009-10-24 at 14:01 +0000, Timothy Madden wrote:
> >> > Can the string literal syntax for CREATE FUNCTION please, please be
> >> > dropped
> >> > ... ?
> >
> > [...]
> >>
> >> > It is not ANSI/ISO and so annoying for compatibility.
> >>
> >> Whatever is inside the string literal is also not ANSI/ISO, so why wou=
ld
> >> it make a difference?
> >>
> > At least the function declaration syntax would be right. I think it wou=
ld
> be
> > an important difference; this string literal idea is so strange and
> > unnatural ...
> >
> > And why the function body would not be standard ?
>
> Because standard knows only SQL/PSM language for SQL procedures.
> Others databases support only one language for sql procedures (PL/SQL,
> T-SQL). But PostgreSQL supports plpgsql, plperl, plpython as sql
> procedures - and I am sure, so standard doesnt calculate with
> multilangual environments.
>


Ok I get it. So Posgres also offers perl and python in addition to SQL.
But at least for SQL, which is included and defined in the standard, could
the syntax be made conforming ? As an alternative to the one already
used (to offer the additional langauges) ?

So that the additional languages are provided as before, and the
standard-definded one still follows the standard ?


Thank you,
Timothy Madden


P.S. :
As a note, actually the standard provides for other languages, with the
procedures only referenced as external (pre-compiled) instead of
defined/scripted in line.

If anyone is interested you have below the CREATE FUNCTION and
CREATE PROCEDURE syntax definition from SQL-3
 (SQL-99, Part 2 - Foundation).

 ::=3D
         PROCEDURE   
        
        

 ::=3D
        {  |  }
         

 ::=3D
        FUNCTION  
        
        
      [  ]

 ::=3D
         
       | 
       | SPECIFIC 
       | 
       | 
       | 
       | 
       | 

 ::=3D
        
      | 

 ::=3D 

 ::=3D
       EXTERNAL [ NAME  ]
          [  ]
          [  ]

 ::=3D
          LANGUAGE 

 ::=3D
          ADA | C | COBOL | FORTRAN | MUMPS | PASCAL | PLI | SQL

 ::=3D
          DYNAMIC RESULT SETS 

 ::=3D
         PARAMETER STYLE 

 ::=3D STATIC DISPATCH
 ::=3D RETURNS  [  ]
 ::=3D CAST FROM 

 ::=3D
           [  ]

 ::=3D  [  ]

 ::=3D
         SQL
       | GENERAL

 ::=3D
       DETERMINISTIC
     | NOT DETERMINISTIC

 ::=3D
        NO SQL
      | CONTAINS SQL
      | READS SQL DATA
      | MODIFIES SQL DATA

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Timothy Madden  writes:
> Ok I get it. So Posgres also offers perl and python in addition to SQL.
> But at least for SQL, which is included and defined in the standard, could
> the syntax be made conforming ?

I think you still haven't got the point: there is *no* function language
that we offer that exactly matches what the spec has got.  Not using
string-literal syntax, difficult as that is already, would probably
represent about 1% of the work needed to implement what the spec
suggests.

			regards, tom lane

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Timothy Madden <terminatorul@gmail.com>
Дата:
On Mon, Oct 26, 2009 at 12:13 AM, Tom Lane  wrote:

> Timothy Madden  writes:
> > Ok I get it. So Posgres also offers perl and python in addition to SQL.
> > But at least for SQL, which is included and defined in the standard,
> could
> > the syntax be made conforming ?
>
> I think you still haven't got the point: there is *no* function language
> that we offer that exactly matches what the spec has got.  Not using
> string-literal syntax, difficult as that is already, would probably
> represent about 1% of the work needed to implement what the spec
> suggests.
>


I would like to put to good use the statements and expression that do match
(SELECT/INSERT/UPDATE/ ...), and the very function declaration syntax is
getting in the way, making even those matches now useless ...

Thank you,
Timothy Madden

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
2009/10/25 Timothy Madden :
>
> On Sun, Oct 25, 2009 at 6:17 PM, Pavel Stehule 
> wrote:
>>
>> 2009/10/25 Timothy Madden :
>> >
>> >
>> > On Sun, Oct 25, 2009 at 12:42 PM, Peter Eisentraut 
>> > wrote:
>> >>
>> >> On l=C3=B6r, 2009-10-24 at 14:01 +0000, Timothy Madden wrote:
>> >> > Can the string literal syntax for CREATE FUNCTION please, please be
>> >> > dropped
>> >> > ... ?
>> >
>> > [...]
>> >>
>> >> > It is not ANSI/ISO and so annoying for compatibility.
>> >>
>> >> Whatever is inside the string literal is also not ANSI/ISO, so why
>> >> would
>> >> it make a difference?
>> >>
>> > At least the function declaration syntax would be right. I think it
>> > would be
>> > an important difference; this string literal idea is so strange and
>> > unnatural ...
>> >
>> > And why the function body would not be standard ?
>>
>> Because standard knows only SQL/PSM language for SQL procedures.
>> Others databases support only one language for sql procedures (PL/SQL,
>> T-SQL). But PostgreSQL supports plpgsql, plperl, plpython as sql
>> procedures - and I am sure, so standard doesnt calculate with
>> multilangual environments.
>
>
> Ok I get it. So Posgres also offers perl and python in addition to SQL.
> But at least for SQL, which is included and defined in the standard, could
> the syntax be made conforming ? As an alternative to the one already
> used (to offer the additional langauges) ?
>

look on plsqlpsm - it is implementation of SQL/PSM.

> So that the additional languages are provided as before, and the
> standard-definded one still follows the=C2=A0standard ?
>
>
> Thank you,
> Timothy Madden
>
>
> P.S. :
> As a note, actually the standard provides for other languages, with the
> procedures only referenced as external (pre-compiled) instead of
> defined/scripted in line.

this is external languages. It is different.

>
> If anyone is interested you have below the CREATE FUNCTION and
> CREATE PROCEDURE syntax definition from SQL-3
> =C2=A0(SQL-99, Part 2 - Foundation).
>
>  ::=3D
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PROCEDURE =C2=A0  declaration list>
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
>
>  ::=3D
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {  | <=
method specification designator> }
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
>
>  ::=3D
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 FUNCTION   list>
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [  ]
>
>  ::=3D
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | SPECIFIC 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 
>
>  ::=3D
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 
> =C2=A0=C2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=A0=C2=A0=C2=A0 | READS SQL DATA
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | MODIFIES SQL DATA
>

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
2009/10/25 Timothy Madden :
>
>
> On Mon, Oct 26, 2009 at 12:13 AM, Tom Lane  wrote:
>>
>> Timothy Madden  writes:
>> > Ok I get it. So Posgres also offers perl and python in addition to SQL.
>> > But at least for SQL, which is included and defined in the standard,
>> > could
>> > the syntax be made conforming ?
>>
>> I think you still haven't got the point: there is *no* function language
>> that we offer that exactly matches what the spec has got. =C2=A0Not using
>> string-literal syntax, difficult as that is already, would probably
>> represent about 1% of the work needed to implement what the spec
>> suggests.
>
>
> I would like to put to good use the statements and expression that do mat=
ch
> (SELECT/INSERT/UPDATE/ ...), and the very function declaration syntax is
> getting in the way, making even those matches now useless ...

???

Pavel
>
> Thank you,
> Timothy Madden
>

Re: BUG #5136: Please drop the string literal syntax for CREATE FUNCTION ...

От:
Timothy Madden <terminatorul@gmail.com>
Дата:
On Mon, Oct 26, 2009 at 6:44 AM, Pavel Stehule wrote:

> 2009/10/25 Timothy Madden :
> >
> [...]
> > I would like to put to good use the statements and expression that do
> match
> > (SELECT/INSERT/UPDATE/ ...), and the very function declaration syntax is
> > getting in the way, making even those matches now useless ...
>
> ???
>
>
It is a way of saying I see this as the first 1% to be done towards SQL/PSM,
so I
can then use the other statements in a function.

Thank you,
Timothy Madden
FAQ