On 04/30/2016 01:19 AM, Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> Surely CREATE OR REPLACE should keep whatever the flag was, rather than
>> ovewrite it with a bogus value if not specified? In other words IMO the
>> CREATE OR REPLACE code needs changing, not system_views.sql.
>
> Absolutely not! The definition of CREATE OR REPLACE is that at the end,
> the state of the object is predictable from only what the command says.
> This is not open for renegotiation.
An example to support Tom is that it already works like the for other
options.
postgres=# CREATE FUNCTION f() RETURNS int LANGUAGE sql AS $$ SELECT 1
$$ SECURITY DEFINER;
CREATE FUNCTION
postgres=# SELECT pg_get_functiondef('f'::regproc); pg_get_functiondef
--------------------------------------- CREATE OR REPLACE FUNCTION public.f()+ RETURNS integer +
LANGUAGEsql + SECURITY DEFINER + AS $function$ SELECT 1 $function$ +
(1 row)
postgres=# CREATE OR REPLACE FUNCTION f() RETURNS int LANGUAGE sql AS $$
SELECT 1 $$;
CREATE FUNCTION
postgres=# SELECT pg_get_functiondef('f'::regproc); pg_get_functiondef
--------------------------------------- CREATE OR REPLACE FUNCTION public.f()+ RETURNS integer +
LANGUAGEsql + AS $function$ SELECT 1 $function$ +
(1 row)
Andreas