Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
It worked when I included the parameter list in the DROP statement. Thank you! Lori -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Wednesday, August 20, 2014 11:54 AM To: Lori Corbani; pgsql-general@postgresql.org Subject: Re: [GENERAL] create function

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Adrian Klaver
On 08/20/2014 08:42 AM, Lori Corbani wrote: OK...if I manually run this within psql it is fine. But I have a shell script in which I am wrapping a call to 'psql'...and I guess it does not like how things are being passed in when I do it this way. So, yes, it is working correctly when I copy/p

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
This worked! Many, many, thanks! -Original Message- From: Rob Sargent [mailto:robjsarg...@gmail.com] Sent: Wednesday, August 20, 2014 10:15 AM To: Adrian Klaver Cc: Lori Corbani; Alban Hertroys; pgsql-general@postgresql.org Subject: Re: [GENERAL] create function : change name of input

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
Will try a different approach to my wrapper. Many thanks! Lori -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Wednesday, August 20, 2014 10:11 AM To: Lori Corbani; pgsql-general@postgresql.org Subject: Re: [GENERAL] create function : change name of input

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Tom Lane
Lori Corbani writes: > My example: > DROP FUNCTION ACC_setMax(); > CREATE OR REPLACE FUNCTION ACC_setMax ( > increment int, > prefixPart varchar(30) = 'MGI:' > ) > RETURNS VOID AS > \$\$ This is not the right thing: you need to include the parameters in the drop command. ACC_setMax() is a tota

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Adrian Klaver
On 08/20/2014 07:00 AM, Lori Corbani wrote: My example: DROP FUNCTION ACC_setMax(); CREATE OR REPLACE FUNCTION ACC_setMax ( increment int, prefixPart varchar(30) = 'MGI:' ) RETURNS VOID AS \$\$ BEGIN /* Increment the max MGI Accession Number by @increment */ update ACC_AccessionMax set maxN

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Adrian Klaver
On 08/20/2014 07:00 AM, Lori Corbani wrote: My example: DROP FUNCTION ACC_setMax(); CREATE OR REPLACE FUNCTION ACC_setMax ( increment int, prefixPart varchar(30) = 'MGI:' ) RETURNS VOID AS \$\$ BEGIN /* Increment the max MGI Accession Number by @increment */ update ACC_AccessionMax set maxN

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Rob Sargent
Include the types in the drop Sent from my iPhone > On Aug 20, 2014, at 7:59 AM, Adrian Klaver wrote: > >> On 08/20/2014 06:51 AM, Lori Corbani wrote: >> >> I *am* definitely dropping the function first. I still get the same error. > > Well we need to see the actual sequence to figure this

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Adrian Klaver
On 08/20/2014 06:51 AM, Lori Corbani wrote: I *am* definitely dropping the function first. I still get the same error. Well we need to see the actual sequence to figure this out. Best guess, is you have more than one function with that name. -- Adrian Klaver adrian.kla...@aklaver.com

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
= prefixPart changed to v_ prefixPart varchar(30) = 'MGI:' where prefixPart = v_prefixPart -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Wednesday, August 20, 2014 9:40 AM To: Lori Corbani; pgsql-general@postgresql.org Subject: Re: [GENERAL] cr

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
I *am* definitely dropping the function first. I still get the same error. -Original Message- From: Alban Hertroys [mailto:haram...@gmail.com] Sent: Wednesday, August 20, 2014 9:44 AM To: Lori Corbani Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] create function : change name

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
Yes, I am doing a DROP and then a CREATE OR REPLACE Let me read over your example... -Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Wednesday, August 20, 2014 9:40 AM To: Lori Corbani; pgsql-general@postgresql.org Subject: Re: [GENERAL] create function

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Alban Hertroys
On 20 August 2014 15:25, Lori Corbani wrote: > The ‘create function’ documentation states: > > ‘You cannot change the name already assigned to any input parameter > (although you can add names to parameters that had none before).’ Further on in that same paragraph (although I looked at the 9.3 d

Re: [GENERAL] create function : change name of input parameter

2014-08-20 Thread Adrian Klaver
On 08/20/2014 06:25 AM, Lori Corbani wrote: Using Postgres Version 9.0.4: We are migrating our Sybase stored procedures to Postgres and need to be able to drop/replace the SPs, making needed changes to input parameters to fix issues/differences between Sybase and Postgres. However, we keep gett

[GENERAL] create function : change name of input parameter

2014-08-20 Thread Lori Corbani
Using Postgres Version 9.0.4: We are migrating our Sybase stored procedures to Postgres and need to be able to drop/replace the SPs, making needed changes to input parameters to fix issues/differences between Sybase and Postgres. However, we keep getting this error when we drop/replace the PG/

[GENERAL] Create (function, procedure) and trigger to increment a counter

2009-07-16 Thread Chris Barnes
I have a table usage, I would like to create a (function or procedure) called by the trigger to increment column counter after an update. Can someone lend me a hand with the process behind creating this function,procedure and trigger. Table "public.usage" Column |

Re: [GENERAL] Create function errors

2007-12-04 Thread Rodrigo De León
On Dec 4, 2007 6:04 PM, Peck, Brian <[EMAIL PROTECTED]> wrote: > SELECT source_id as vertex INTO result FROM $3 ORDER BY > Distance(the_geom,PointFromText(POINT( $1 $2 ))) LIMIT 1; I think you're missing a comma, e.g. POINT( $1 , $2 ). ---(end of broadcast)---

[GENERAL] Create function errors

2007-12-04 Thread Peck, Brian
Hey all, I'm trying to create functions for the calls I'm making to limit the number of DB pings I have to make (i.e. after they are all calls make one call that calls them in succession) and I'm getting an error. The function is CREATE OR REPLACE FUNCTION nearestVertex(x1 double preci

Re: [GENERAL] create function error

2007-07-31 Thread Tony Crisera
Sorry, received information I wasn't aware of. My understanding was this was all running on the db server, but the script was actually being executed through another server (web) that only had a 7.4 client. This appears to have been the problem. Thanks. Tony Crisera Michael Glaesemann

Re: [GENERAL] create function error

2007-07-28 Thread Michael Glaesemann
On Jul 26, 2007, at 13:22 , Tony Crisera wrote: ERROR: unterminated dollar-quoted string at or near "$$ BEGIN NEW.mod_date := now();" at character 63 ERROR: syntax error at or near "RETURN" at character 9 WARNING: there is no transaction in progress ERROR: unterminated dollar-quoted stri

[GENERAL] create function error

2007-07-28 Thread Tony Crisera
We have gotten these errors every time we try to create a function through psql. However, if we run the same statements using phpPgAdmin or pgAdmin III query tool it works fine. Here's the error- ERROR: unterminated dollar-quoted string at or near "$$ BEGIN NEW.mod_date := now();" at charac

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Richard Huxton
Jan Danielsson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations for it, then store those prepar

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Merlin Moncure
On 6/29/07, Jan Danielsson <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Merlin Moncure
On 6/29/07, Jan Danielsson <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations

[GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Jan Danielsson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations for it, then store those preparations somewhere for whe

Re: [GENERAL] CREATE FUNCTION Fails with an Insert Statement in it

2007-01-23 Thread A. Kretschmer
am Tue, dem 23.01.2007, um 11:51:00 -0500 mailte Jasbinder Singh Bali folgendes: > I have created the following function : > > > CREATE OR REPLACE FUNCTION sp_insert_tbl_l_header(int4,text) > RETURNS bool AS > $BODY$ > INSERT INTO tbl_xyz > (unmask_id,email_from) > VALUES ($1,$2) > $BODY$ >

Re: [GENERAL] CREATE FUNCTION Fails with an Insert Statement in it

2007-01-23 Thread Merlin Moncure
On 1/23/07, Jasbinder Singh Bali <[EMAIL PROTECTED]> wrote: I have created the following function : CREATE OR REPLACE FUNCTION sp_insert_tbl_l_header(int4,text) RETURNS bool AS $BODY$ INSERT INTO tbl_xyz (unmask_id,email_from) VALUES ($1,$2) $BODY$ LANGUAGE 'sql' VOLATILE; when i try to c

[GENERAL] CREATE FUNCTION Fails with an Insert Statement in it

2007-01-23 Thread Jasbinder Singh Bali
I have created the following function : CREATE OR REPLACE FUNCTION sp_insert_tbl_l_header(int4,text) RETURNS bool AS $BODY$ INSERT INTO tbl_xyz (unmask_id,email_from) VALUES ($1,$2) $BODY$ LANGUAGE 'sql' VOLATILE; when i try to create this fucntion by running this script, i get the following

Re: [GENERAL] Create function problem

2006-08-04 Thread gustavo halperin
Michael Fuhr wrote: On Fri, Aug 04, 2006 at 06:44:16PM +0300, gustavo halperin wrote: Michael Fuhr wrote: Since the function has OUT parameters you can use "RETURNS SETOF record" like this: CREATE FUNCTION funcname() RETURNS SETOF record AS $$ $$ LANGUAGE SQL What do you mean w

Re: [GENERAL] Create function problem

2006-08-04 Thread Michael Fuhr
On Fri, Aug 04, 2006 at 06:44:16PM +0300, gustavo halperin wrote: > Michael Fuhr wrote: > >Since the function has OUT parameters you can use "RETURNS SETOF record" > >like this: > > > >CREATE FUNCTION funcname() RETURNS SETOF record AS $$ > > > >$$ LANGUAGE SQL > > What do you mean with the word "r

Re: [GENERAL] Create function problem

2006-08-04 Thread gustavo halperin
Michael Fuhr wrote: [Please copy the mailing list on replies so others can contribute to and learn from the discussion.] On Fri, Aug 04, 2006 at 11:20:55AM +0300, gustavo halperin wrote: Michael Fuhr wrote: You've hardcoded the strings 'v_tbl_schm' and 'v_tbl_name' instead of using the

Re: [GENERAL] Create function problem

2006-08-04 Thread Michael Fuhr
[Please copy the mailing list on replies so others can contribute to and learn from the discussion.] On Fri, Aug 04, 2006 at 11:20:55AM +0300, gustavo halperin wrote: > Michael Fuhr wrote: > >You've hardcoded the strings 'v_tbl_schm' and 'v_tbl_name' instead > >of using the function's arguments.

Re: [GENERAL] Create function problem

2006-08-03 Thread Michael Fuhr
On Fri, Aug 04, 2006 at 06:16:41AM +0300, gustavo halperin wrote: > *OK thank you, you right, but after write "public" I receive again an > empty row, Why??. [...] > mydb=> CREATE OR REPLACE FUNCTION f_describe_tables (v_tbl_scm text, > v_tbl_name text, > mydb(> OUT text, OUT text) as > mydb-> $

Re: [GENERAL] Create function problem

2006-08-03 Thread gustavo halperin
Ron St-Pierre wrote: Check your spelling of public: SELECT * FROM f_describe_tables('pubilc', 'mil_cien_diez'); Ron *OK thank you, you right, but after write "public" I receive again an empty row, Why??. By the way I wrote a short function:* /mydb=> SELECT c.column_name, c.data_type mydb-> F

Re: [GENERAL] Create function problem

2006-08-03 Thread Michael Fuhr
On Fri, Aug 04, 2006 at 01:51:19AM +0300, gustavo halperin wrote: > In order to know the names and data types of the table "mil_cien_diez" > from the schema "public" I run the next 'SELECT' but when I try to > create a SQL function and after it I run it, I receive an empty row. Can > you see the

[GENERAL] Create function problem

2006-08-03 Thread gustavo halperin
*Hello I have a little question In order to know the names and data types of the table "mil_cien_diez" from the schema "public" I run the next 'SELECT' but when I try to create a SQL function and after it I run it, I receive an empty row. Can you see the problem ??* /mydb=> SELECT c.column_n

Re: [GENERAL] create function syntax error

2006-07-29 Thread Andreas Kretschmer
Andreas Kretschmer <[EMAIL PROTECTED]> schrieb: > gustavo halperin <[EMAIL PROTECTED]> schrieb: > > > Hello > > > > I Always get "syntax error" for every function that I try to create, for > > example: > > mydb'>create or replace function f_sum () returns void as ' > > mydb'> select 2+2

Re: [GENERAL] create function syntax error

2006-07-29 Thread Shoaib Mir
You are missing the BEGIN and END section. Make your function like this:CREATE OR REPLACE FUNCTION f_sum() RETURNS void AS 'BEGIN   select 2+2; END;' LANGUAGE plpgsql;Thanks,-- Shoaib Mir EnterpriseDB (www.enterprisedb.com)On 7/30/06, gustavo halperin <[EMAIL PROTECTED]> wrote: HelloI Always get

Re: [GENERAL] create function syntax error

2006-07-29 Thread Andreas Kretschmer
gustavo halperin <[EMAIL PROTECTED]> schrieb: > Hello > > I Always get "syntax error" for every function that I try to create, for > example: > mydb'>create or replace function f_sum () returns void as ' > mydb'> select 2+2; > mydb'> ' LANGUAGE plpgsql; > ERROR: syntax error at

[GENERAL] create function syntax error

2006-07-29 Thread gustavo halperin
Hello I Always get "syntax error" for every function that I try to create, for example: mydb'>create or replace function f_sum () returns void as ' mydb'> select 2+2; mydb'> ' LANGUAGE plpgsql; ERROR: syntax error at or near "select" at character 56 LINE 2: select 2+2; ^

Re: [GENERAL] CREATE FUNCTION

2004-08-08 Thread Tom Lane
Jiri Nemec <[EMAIL PROTECTED]> writes: > CREATE FUNCTION foo(int2) > RETURNS TEXT > AS 'DECLARE ret TEXT; >begin > SELECT INTO ret CAST(name AS text) > FROM shop_goods > WHERE id = $1; > return ret; >end;' > language 'sql'; This is a plpgsql function, not a sql func

Re: [GENERAL] CREATE FUNCTION

2004-08-08 Thread gnari
[ CC'd to "Jiri Nemec" <[EMAIL PROTECTED]>] "Jiri Nemec" <[EMAIL PROTECTED]> said: > Hello all, sorry about beginner question, but I'm sure function has > correct structure, buw PostgreSQL reports error. (This function is > only on approbation.) > > CREATE FUNCTION foo(int2) > RETURNS TEXT > AS

[GENERAL] CREATE FUNCTION

2004-08-08 Thread Jiri Nemec
Hello all, sorry about beginner question, but I'm sure function has correct structure, buw PostgreSQL reports error. (This function is only on approbation.) CREATE FUNCTION foo(int2) RETURNS TEXT AS 'DECLARE ret TEXT; begin SELECT INTO ret CAST(name AS text) FROM shop_goods WH

Re: [GENERAL] create function for trigger question

2003-11-06 Thread Darren Ferguson
Barbera What you have written is a stored procedure not a trigger function. Trigger functions until 7.2 return generally OPAQUE and after 7.2 they return TRIGGER. See the example of a trigger below for your function CREATE OR REPLACE FUNCTION customer_bak_proc() RETURNS TRIGGER AS ' BEGIN IF T

[GENERAL] create function for trigger question

2003-11-06 Thread Barbara Lindsey
I am a postgres newbie. I am trying to create a trigger that will put a copy of a record into a backup table before update or delete. As I understand it, in order to do this I must have a function created to do this task. The function I am trying to create is as follows: CREATE FUNCTION custome

Re: [GENERAL] Create Function... ERROR: language "plpgsql" does not exist

2003-10-15 Thread Chet Luther
You need to create the plpgsql language in your database first. See http://www.faqs.org/docs/ppbook/c19610.htm for how to do this. Hope this helps, [EMAIL PROTECTED] [EMAIL PROTECTED] ("Thomas LeBlanc") wrote in message news:<[EMAIL PROTECTED]>... > I copied an example from the help: > > CREATE

[GENERAL] Create function without return value?

2001-07-05 Thread Daniel Åkerud
Can you create a function (CREATE FUNCTION) that does not return any value?   ---Daniel Åkerud   [ Don't underestimate the power of stupid people in large groups]

Re: [GENERAL] CREATE FUNCTION problem

2000-11-02 Thread Tom Lane
"Cesar A. K. Grossmann" <[EMAIL PROTECTED]> writes: > create function > vinculoExportacao (varchar) > returns setof > as 'select codigo, nome, ''T'' as selected > from cad_exportacao > ... > psql:tmp/teste2.sql:15: ERROR: parser: parse error at or near "as" setof *what* ? The parser is expectin

[GENERAL] CREATE FUNCTION problem

2000-11-02 Thread Cesar A. K. Grossmann
Hi! I'm trying to use pgaccess to create a function that returns the same tuples the query bellow: select codigo, nome, 'T' as selected from cad_exportacao where codigo in ( select codigo from user_codigo where username = 'cesar' and tipo

Re: [GENERAL] CREATE FUNCTION LANGUAGE C

2000-10-11 Thread Alex Pilosov
Yes, that is why only superusers have access to 'create function language c' -alex On Wed, 11 Oct 2000, Marc SCHAEFER wrote: > Hi, > > CREATE FUNCTION LANGUAGE C (and maybe others) allow to load shared > libraries. However the path can be specified arbitrarily by the user. Is > that a way for

[GENERAL] CREATE FUNCTION LANGUAGE C

2000-10-11 Thread Marc SCHAEFER
Hi, CREATE FUNCTION LANGUAGE C (and maybe others) allow to load shared libraries. However the path can be specified arbitrarily by the user. Is that a way for a user X to gain the UID rights of the user running the postmaster ?