Version 9.4 CREATE FUNCTION - ERROR: type xxxx does not exist create function

Started by Nicoleover 10 years ago2 messagesbugs
Jump to latest
#1Nicole
nicole.king464@gmail.com

Given this function body:

DECLARE
recurrence Client_Appointment_Recurrences;
...
BEGIN
...
END

and a table called "Client_Appointment_Recurrences", the message is
"ERROR: type client_appointment_recurrences does not exist".

Rename the table to "client_appointment_recurrences" and the error vanishes

Regards

Nicole

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Joe Conway
mail@joeconway.com
In reply to: Nicole (#1)
Re: Version 9.4 CREATE FUNCTION - ERROR: type xxxx does not exist create function

On 11/04/2015 08:39 AM, Nicole wrote:

DECLARE
recurrence Client_Appointment_Recurrences;

This is not a bug and not the appropriate list for a question. That
said, try this:

8<------------------
CREATE TABLE "Client_Appointment_Recurrences" (id int);

CREATE OR REPLACE FUNCTION test() RETURNS text AS $$
DECLARE
recurrence "Client_Appointment_Recurrences";
BEGIN
RETURN 'ok';
END$$ LANGUAGE plpgsql;

SELECT test();
test
------
ok
(1 row)
8<------------------

HTH,

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development