Re: Another issue in default-values patch: defaults expanded too soon - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Another issue in default-values patch: defaults expanded too soon
Date
Msg-id 49483418.7070106@agliodbs.com
Whole thread Raw
In response to Another issue in default-values patch: defaults expanded too soon  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Another issue in default-values patch: defaults expanded too soon
List pgsql-hackers
Tom Lane wrote:
> Consider
> 
> create function foo(f1 int, f2 int = 42, f2 int = 43) ...
> create view v1 as select foo(11);
> 
> In CVS HEAD this gives
> 
> regression=# \d v1
>        View "public.v1"
>  Column |  Type   | Modifiers 
> --------+---------+-----------
>  foo    | integer | 
> View definition:
>  SELECT foo(11, 42, 43) AS foo;
> 
> which is an accurate representation of the truth: if you change the
> defaults for function foo, v1 will keep on calling it with the old
> default values.
> 
> Does anyone think this is either unsurprising or desirable?

Huh?  Shouldn't changing a function which a view depends on require a 
rebuild of the view?

That is, I think we should treat changing the defaults the same as we 
would changing the number and type of parameters; it kicks off a 
dependency check and requires a CASCADE.

--Josh


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Another issue in default-values patch: defaults expanded too soon
Next
From: Tom Lane
Date:
Subject: Re: Another issue in default-values patch: defaults expanded too soon