The new \ef psql command creates nicely usable "CREATE OR REPLACE
FUNCTION ..." text based on the function I tell it to edit, but the
text it creates *doesn't* include a final semicolon, so when I exit my
editor-of-choice after messing with my function, it doesn't run the
code I've given it until I type one of my own. This is annoying. See
attached for a patch to fix it.

- Josh / eggyknap
Index: src/bin/psql/command.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.196
diff -c -r1.196 command.c
*** src/bin/psql/command.c	15 Sep 2008 12:18:00 -0000	1.196
--- src/bin/psql/command.c	10 Oct 2008 23:37:15 -0000
***************
*** 483,500 ****
  								  " LANGUAGE \n"
  								  " -- common options:  IMMUTABLE  STABLE  STRICT  SECURITY DEFINER\n"
  								  "AS $function$\n"
! 								  "\n$function$\n");
  			}
  			else if (!lookup_function_oid(pset.db, func, &foid))
  			{
  				/* error already reported */
  				status = PSQL_CMD_ERROR;
  			}
! 			else if (!get_create_function_cmd(pset.db, foid, query_buf))
! 			{
! 				/* error already reported */
! 				status = PSQL_CMD_ERROR;
! 			}
  			if (func)
  				free(func);
  		}
--- 483,504 ----
  								  " LANGUAGE \n"
  								  " -- common options:  IMMUTABLE  STABLE  STRICT  SECURITY DEFINER\n"
  								  "AS $function$\n"
! 								  "\n$function$;\n");
  			}
  			else if (!lookup_function_oid(pset.db, func, &foid))
  			{
  				/* error already reported */
  				status = PSQL_CMD_ERROR;
  			}
! 			else 
! 				if (!get_create_function_cmd(pset.db, foid, query_buf))
! 				{
! 					/* error already reported */
! 					status = PSQL_CMD_ERROR;
! 				}
! 				else {
! 					appendPQExpBufferChar(query_buf, ';');
! 				}
  			if (func)
  				free(func);
  		}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to