pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: George Weaver <georgew1@mts.net>
To: Kumar <sgnerd@yahoo.com.sg>
Cc: pgsql-sql@postgresql.org
Subject: Re: Object description at Client Window
Date: Fri, 17 Oct 2003 09:49:13 -0500
Message-ID: <005f01c394bd$ea11f100$2a0da18e@cleartag> (raw)
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>

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




view thread (8+ messages)

Message-ID: <005f01c394bd$ea11f100$2a0da18e@cleartag>
Permalink:  ../005f01c394bd$ea11f100$2a0da18e@cleartag/
Also on:    postgresql.org/message-id/005f01c394bd$ea11f100$2a0da18e@cleartag

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: georgew1@mts.net, sgnerd@yahoo.com.sg
  Subject: Re: Object description at Client Window
  In-Reply-To: <005f01c394bd$ea11f100$2a0da18e@cleartag>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox