Search code examples
postgresqlrdbmsddl

How to replace function in postgress?


I want to change code of function. If i use

CREATE FUNCTION take_proxy (VARCHAR(255)) ....

I get function "take_proxy" already exists with same argument types

Should i always firest try to delete function or is there some syntaxis for this cases?


Solution

  • As usual, the fine manual is the place to go:

    CREATE [ OR REPLACE ] FUNCTION
    

    CREATE OR REPLACE FUNCTION will either create a new function, or replace an existing definition.