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
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
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
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
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
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
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
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
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
= 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
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
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
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
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
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/
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 |
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)---
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
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
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
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
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
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
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
-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
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$
>
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
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
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
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
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
[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.
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-> $
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
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
*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
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
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
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
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;
^
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
[ 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
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
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
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
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
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]
"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
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
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
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 ?
51 matches
Mail list logo