X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CC792D1B53D for ; Fri, 17 Oct 2003 14:50:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55728-09 for ; Fri, 17 Oct 2003 11:49:40 -0300 (ADT) Received: from smtp2.mts.net (smtp2.mts.net [205.200.16.113]) by svr1.postgresql.org (Postfix) with ESMTP id 7477FD1B4E3 for ; Fri, 17 Oct 2003 11:49:35 -0300 (ADT) Received: from cleartag (wnpgmb01bbz-ac04-p13-42.mts.net [142.161.13.42]) by smtp2.mts.net (8.12.8-20030918/8.11.3) with SMTP id h9HEnbNs023981; Fri, 17 Oct 2003 09:49:38 -0500 (CDT) Message-ID: <005f01c394bd$ea11f100$2a0da18e@cleartag> From: "George Weaver" To: "Kumar" Cc: References: <005401c39474$db9cf640$7502a8c0@hdsc.com> <3F8F8A37.1010208@racistnames.com> <007b01c3948a$de7800b0$7502a8c0@hdsc.com> <200310171024.17494.dev@archonet.com> <00ea01c394ab$7b0576e0$7502a8c0@hdsc.com> Subject: Re: Object description at Client Window Date: Fri, 17 Oct 2003 09:49:13 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/211 X-Sequence-Number: 15611 Kumar, pg_class.relname is type "name". You are trying to compare it to p_tablename which is type "varchar". Try changing your function definition to: CREATE OR REPLACE FUNCTION public.desc_table(name) ^^^^ HTH George SNIP > CREATE OR REPLACE FUNCTION public.desc_table(varchar) > RETURNS refcursor AS > 'DECLARE > > ref REFCURSOR ; > p_tablename ALIAS FOR $1; > > BEGIN > OPEN ref FOR > SELECT a.attname, > format_type(a.atttypid, a.atttypmod), > a.attnotnull, > a.atthasdef, > a.attnum > FROM pg_class c, pg_attribute a > WHERE c.relname = p_tablename > AND a.attnum > 0 > AND a.attrelid = c.oid > ORDER BY a.attnum; > > RETURN ref; > END;' > LANGUAGE 'plpgsql' VOLATILE; > > > While trying to execute this > select desc_table('companies'); > > I got the following error. > WARNING: Error occurred while executing PL/pgSQL function desc_table > WARNING: line 7 at open > > ERROR: Unable to identify an operator '=' for types 'name' and 'character > varying' > You will have to retype this query using an explicit cast > SNIP