Re: how to drop function?

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to drop function?
Date: 2011-11-16 09:03:36
Message-ID: 20111116100336.1a8d2191@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 16 Nov 2011 09:17:45 +0100
Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> Ivan Sergio Borgonovo, 16.11.2011 01:01:
> > test=# begin;
> > create or replace function process_table (
> > action TEXT, v_table_name varchar(100)
> > ) RETURNS BOOLEAN
> > AS $$
> > DECLARE
> >
> > BEGIN
> > return true;
> > END;
> > $$ LANGUAGE plpgsql;
> >
> > drop function process_table (
> > action TEXT, v_table_name varchar(100)
> > );
> > commit;
> > BEGIN
> > CREATE FUNCTION
> > DROP FUNCTION
> > COMMIT
> > test=#
> >
> > Repeat just the input parameters.
>
> You don't have to include the parameter names though
>
> drop function process_table (TEXT, varchar(100));

> is just as good and bit less typing ;)

In psql/pgadmin you've tab completion. It will complete without the
parameters name.
If you're writing more durable code generally you can just cut&paste
the creation code.

I admit I haven't spent enough time to see if I can have tab
completion inside my IDE/editor.

When you're refactoring the function most probably you'll have to
refactor the drop code too.

I tend to refactor much more frequently the number/type of parameters
rather than the names, so skipping the names is anticipating some
work that I'll seldom take advantage of.

I admit I drop functions much more frequently in psql rather than in
my IDE/editor, but still I generally have the creation code handy.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message MikeW 2011-11-16 09:26:46 Re: syntax highlighting in emacs after \e in psql
Previous Message Thomas Kellerer 2011-11-16 08:17:45 Re: how to drop function?