Thread: default parameters

default parameters

From
Andrey Vinogradov
Date:
Hi,<br /><br />There is a function with the default parameter:<br /><br />CREATE OR REPLACE FUNCTION test(p_int integer
<u>default1</u>)<br />  RETURNS void AS<br />$BODY$declare<br />begin<br />--foo;<br />end;$BODY$<br />  LANGUAGE
plpgsqlVOLATILE<br />   COST 100;<br /><br /><br />The object browser of the pgAdmin III has been refreshed more than
once. The SQL query of the test fuction is<br /><br />CREATE OR REPLACE FUNCTION test(p_int integer) -- <=== default
valueis disappear<br />   RETURNS void AS<br />$BODY$declare<br />begin<br />--foo;<br />end;$BODY$<br />  LANGUAGE
plpgsqlVOLATILE<br />  COST 100;<br clear="all" /><br />pgAdmin III Version 1.14.3 (Jun 1 2012, rev:REL-1_14_3)<br
/>postgresql-9.1.4-1-windows-x64<br/> Windows 7<br />-- <br /><pre></pre>Thanks and best wishes,<br
style="color:rgb(51,0,51);font-family:trebuchetms,sans-serif" /><span style="color:rgb(51,0,51);font-family:trebuchet
ms,sans-serif">AndreiVinogradov</span><br style="color:rgb(51,0,51);font-family:trebuchet ms,sans-serif" /><span
style="color:rgb(51,0,51);font-family:trebuchetms,sans-serif"></span><br style="font-family:trebuchet
ms,sans-serif;color:rgb(51,0,51)"/><span style="font-family:trebuchet ms,sans-serif;color:rgb(51,0,51)">email:  <a
href="mailto:octonog@gmail.com"target="_blank">octonog@gmail.com</a></span><br /><br /> 

Re: default parameters

From
Guillaume Lelarge
Date:
On Mon, 2012-07-02 at 15:04 +0400, Andrey Vinogradov wrote:
> Hi,
> 
> There is a function with the default parameter:
> 
> CREATE OR REPLACE FUNCTION test(p_int integer *default 1*)
>   RETURNS void AS
> $BODY$declare
> begin
> --foo;
> end;$BODY$
>   LANGUAGE plpgsql VOLATILE
>   COST 100;
> 
> 
> The object browser of the pgAdmin III has been refreshed more than once.
> The SQL query of the test fuction is
> 
> CREATE OR REPLACE FUNCTION test(p_int integer) -- <=== default value is
> disappear
>   RETURNS void AS
> $BODY$declare
> begin
> --foo;
> end;$BODY$
>   LANGUAGE plpgsql VOLATILE
>   COST 100;
> 
> pgAdmin III Version 1.14.3 (Jun 1 2012, rev:REL-1_14_3)
> postgresql-9.1.4-1-windows-x64
> Windows 7

It works in 1.16 beta 2. And there shouldn't be any more release of
1.14. So I advise you to update to 1.16 beta.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Kozusznik Michal
Date:
I repored this bug already. try 1.14.2 

MK

2. 7. 2012 v 13:09, "Andrey Vinogradov" <octonog@gmail.com>:

Hi,

There is a function with the default parameter:

CREATE OR REPLACE FUNCTION test(p_int integer default 1)
  RETURNS void AS
$BODY$declare
begin
--foo;
end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;


The object browser of the pgAdmin III has been refreshed more than once.  The SQL query of the test fuction is

CREATE OR REPLACE FUNCTION test(p_int integer) -- <=== default value is disappear
  RETURNS void AS
$BODY$declare
begin
--foo;
end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

pgAdmin III Version 1.14.3 (Jun 1 2012, rev:REL-1_14_3)
postgresql-9.1.4-1-windows-x64
Windows 7
--
 Thanks and best wishes,
Andrei Vinogradov

email:  octonog@gmail.com

Re: default parameters

From
Maximilian Tyrtania
Date:
Am 02.07.2012 um 22:46 schrieb Guillaume Lelarge:

> On Mon, 2012-07-02 at 15:04 +0400, Andrey Vinogradov wrote:
>> Hi,
>>
>> There is a function with the default parameter:
>>
>> CREATE OR REPLACE FUNCTION test(p_int integer *default 1*)
>>  RETURNS void AS
>> $BODY$declare
>> begin
>> --foo;
>> end;$BODY$
>>  LANGUAGE plpgsql VOLATILE
>>  COST 100;
>>
>>
>> The object browser of the pgAdmin III has been refreshed more than once.
>> The SQL query of the test fuction is
>>
>> CREATE OR REPLACE FUNCTION test(p_int integer) -- <=== default value is
>> disappear
>>  RETURNS void AS
>> $BODY$declare
>> begin
>> --foo;
>> end;$BODY$
>>  LANGUAGE plpgsql VOLATILE
>>  COST 100;
>>
>> pgAdmin III Version 1.14.3 (Jun 1 2012, rev:REL-1_14_3)
>> postgresql-9.1.4-1-windows-x64
>> Windows 7
>
> It works in 1.16 beta 2. And there shouldn't be any more release of
> 1.14. So I advise you to update to 1.16 beta.

I'm still seeing this issue in 1.16 beta 2. I'm on Mac OS 10.7.4, running PG 9.0.3

Maximilian Tyrtania
http://www.contactking.de



Re: default parameters

From
Guillaume Lelarge
Date:
On Wed, 2012-07-18 at 16:22 +0200, Maximilian Tyrtania wrote:
> Am 02.07.2012 um 22:46 schrieb Guillaume Lelarge:
> 
> > On Mon, 2012-07-02 at 15:04 +0400, Andrey Vinogradov wrote:
> >> Hi,
> >> 
> >> There is a function with the default parameter:
> >> 
> >> CREATE OR REPLACE FUNCTION test(p_int integer *default 1*)
> >>  RETURNS void AS
> >> $BODY$declare
> >> begin
> >> --foo;
> >> end;$BODY$
> >>  LANGUAGE plpgsql VOLATILE
> >>  COST 100;
> >> 
> >> 
> >> The object browser of the pgAdmin III has been refreshed more than once.
> >> The SQL query of the test fuction is
> >> 
> >> CREATE OR REPLACE FUNCTION test(p_int integer) -- <=== default value is
> >> disappear
> >>  RETURNS void AS
> >> $BODY$declare
> >> begin
> >> --foo;
> >> end;$BODY$
> >>  LANGUAGE plpgsql VOLATILE
> >>  COST 100;
> >> 
> >> pgAdmin III Version 1.14.3 (Jun 1 2012, rev:REL-1_14_3)
> >> postgresql-9.1.4-1-windows-x64
> >> Windows 7
> > 
> > It works in 1.16 beta 2. And there shouldn't be any more release of
> > 1.14. So I advise you to update to 1.16 beta.
> 
> I'm still seeing this issue in 1.16 beta 2. I'm on Mac OS 10.7.4, running PG 9.0.3
> 

Still works for me on PostgreSQL 9.0.8, and pgAdmin 1.16 and 1.17.
Doesn't work on 1.14 but, as I said, there won't be any more release of
1.14.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Maximilian Tyrtania
Date:
Hi Guillaume,

strange…please take a look at <https://dl.dropbox.com/u/73031955/Bildschirmaufnahme%208.mov>

Is there something you're doing differently?

Maximilian Tyrtania
http://www.contactking.de

> Still works for me on PostgreSQL 9.0.8, and pgAdmin 1.16 and 1.17.
> Doesn't work on 1.14 but, as I said, there won't be any more release of
> 1.14.


Re: default parameters

From
Guillaume Lelarge
Date:
On Fri, 2012-07-20 at 15:38 +0200, Maximilian Tyrtania wrote:
> Hi Guillaume,
>
> strange…please take a look at <https://dl.dropbox.com/u/73031955/Bildschirmaufnahme%208.mov>
>
> Is there something you're doing differently?
>

Nope. I'm quite puzzled. Can you give me the result of these queries?

SELECT count(*) FROM pg_attribute
WHERE attrelid = 'pg_catalog.pg_proc'::regclass AND attname = 'proargdefaults';

and

SELECT count(*) FROM pg_attribute
WHERE attrelid = 'pg_catalog.pg_proc'::regclass AND attname = 'proargdefvals';

(they are both used to check if the database has default values support
on functions)

Thanks.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Guillaume Lelarge
Date:
On Fri, 2012-07-20 at 20:25 +0200, Maximilian Tyrtania wrote:
> Am 20.07.2012 um 18:36 schrieb Guillaume Lelarge:
> 
> > Nope. I'm quite puzzled. Can you give me the result of these queries?
> 
> Sure.
> 
> > SELECT count(*) FROM pg_attribute
> > WHERE attrelid = 'pg_catalog.pg_proc'::regclass
> >  AND attname = 'proargdefaults';
> 
> 1
> 
> > 
> > and
> > 
> > SELECT count(*) FROM pg_attribute
> > WHERE attrelid = 'pg_catalog.pg_proc'::regclass
> >  AND attname = 'proargdefvals';
> 
> 
> 0
> 

OK. Then, can you give me the results of this query?

SELECT pr.oid, pr.xmin, pr.*, format_type(TYP.oid, NULL) AS typname, typns.nspname AS typnsp, lanname, proargnames,
pg_get_expr(proargdefaults,'pg_catalog.pg_class'::regclass) AS
 
proargdefaultvals, pronargdefaults, proconfig,
pg_get_userbyid(proowner) as funcowner, description,
(SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=pr.oid)
AS labels,
(SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE
sl2.objoid=pr.oid) AS providers FROM pg_proc pr JOIN pg_type typ ON typ.oid=prorettype JOIN pg_namespace typns ON
typns.oid=typ.typnamespaceJOIN pg_language lng ON lng.oid=prolang LEFT OUTER JOIN pg_description des ON
des.objoid=pr.oidWHEREproisagg = FALSE AND pronamespace = 2200::oid  AND typname = 'trigger'  AND lanname !=
'edbspl'ORDERBY proname;
 

Please, do it inside psql, and first fire a \x meta-command. And then
send the result as an attached file. Thank you.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Guillaume Lelarge
Date:
On Mon, 2012-07-23 at 09:35 +0200, Maximilian Tyrtania wrote:
> Ah, no problem, here you go.
> 
> test=# SELECT pr.oid, pr.xmin, pr.*, format_type(TYP.oid, NULL) AS typname,
> test-#  typns.nspname AS typnsp, lanname, proargnames, 
> test-#  pg_get_expr(proargdefaults, 'pg_catalog.pg_class'::regclass) AS
> test-# proargdefaultvals, pronargdefaults, proconfig,
> test-# pg_get_userbyid(proowner) as funcowner, description,
> test-# (SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=pr.oid)
> test-# AS labels,
> test-# (SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE
> test(# sl2.objoid=pr.oid) AS providers
> test-#  FROM pg_proc pr
> test-#  JOIN pg_type typ ON typ.oid=prorettype
> test-#  JOIN pg_namespace typns ON typns.oid=typ.typnamespace
> test-#  JOIN pg_language lng ON lng.oid=prolang
> test-#  LEFT OUTER JOIN pg_description des ON des.objoid=pr.oid
> test-# WHERE proisagg = FALSE AND pronamespace = 2200::oid
> test-# ORDER BY proname;
> -[ RECORD 1
]-----+------------------------------------------------------------------------------------------------------------------------------------------------------
> oid               | 18994
> xmin              | 3494
> proname           | test
> pronamespace      | 2200
> proowner          | 10
> prolang           | 11658
> procost           | 100
> prorows           | 0
> provariadic       | 0
> proisagg          | f
> proiswindow       | f
> prosecdef         | f
> proisstrict       | f
> proretset         | f
> provolatile       | v
> pronargs          | 1
> pronargdefaults   | 1
> prorettype        | 2278
> proargtypes       | 23
> proallargtypes    | 
> proargmodes       | 
> proargnames       | {p_int}
> proargdefaults    | ({CONST :consttype 23 :consttypmod -1 :constcollid 0 :constlen 4 :constbyval true :constisnull
false:location 54 :constvalue 4 [ 1 0 0 0 0 0 0 0 ]})
 
> prosrc            | declare
>                   | begin
>                   | --foo;
>                   | end;
> probin            | 
> proconfig         | 
> proacl            | 
> typname           | void
> typnsp            | pg_catalog
> lanname           | plpgsql
> proargnames       | {p_int}
> proargdefaultvals | 1
> pronargdefaults   | 1
> proconfig         | 
> funcowner         | postgres
> description       | 
> labels            | 
> providers         | 
> 

Well, I have the same details for my own function. I don't know what to
tell you. Are you sure you don't have two releases of pgAdmin on your
machine?

You are on windows, right?


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Maximilian Tyrtania
Date:
Am 23.07.2012 um 18:49 schrieb Guillaume Lelarge:

> Well, I have the same details for my own function. I don't know what to
> tell you. Are you sure you don't have two releases of pgAdmin on your
> machine?

Actually I do have 2 releases. After I noticed that problem in 14.2 I installed 1.16 beta 2, because you said the bug
isfixed there. Anyway, as you can see in the movie, I made sure I used 1.16 beta 2 to verify the bug is still around. 

> You are on windows, right?

Nope. Mac OS 10.7.4

Maximilian Tyrtania
http://www.contactking.de




Re: default parameters

From
Guillaume Lelarge
Date:
On Tue, 2012-07-24 at 06:37 +0200, Maximilian Tyrtania wrote:
> Am 23.07.2012 um 18:49 schrieb Guillaume Lelarge:
> 
> > Well, I have the same details for my own function. I don't know what to
> > tell you. Are you sure you don't have two releases of pgAdmin on your
> > machine?
> 
> Actually I do have 2 releases. After I noticed that problem in 14.2 I installed 1.16 beta 2, because you said the bug
isfixed there. Anyway, as you can see in the movie, I made sure I used 1.16 beta 2 to verify the bug is still around.
 
> 
> > You are on windows, right?
> 
> Nope. Mac OS 10.7.4 
> 

Sorry, Andrey has the Windows box, and you the Mac OS box.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: default parameters

From
Michal Kozusznik
Date:
>> Actually I do have 2 releases. After I noticed that problem in 14.2

For windows version this bug appeared in 14.3 for postgresql versions 
lower than 9.
14.2 works fine.


Re: default parameters

From
Maximilian Tyrtania
Date:
Am 24.07.2012 um 10:37 schrieb Michal Kozusznik:

>>> Actually I do have 2 releases. After I noticed that problem in 14.2
>
> For windows version this bug appeared in 14.3 for postgresql versions lower than 9.
> 14.2 works fine.

Ah, yes, sorry. It's working fine on Mac OS in 14.2 but not in 14.3 nor in 16.2.
Tested against PG 9.1.3

Maximilian Tyrtania
http://www.contactking.de