pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jean-Denis Giguere <jdenisgiguere@fastmail.fm>
Cc: pgsql-admin@postgresql.org
Subject: Re: grant execute on many functions
Date: Tue, 29 Jun 2004 21:45:05 -0700
Message-ID: <40E24551.3080606@joeconway.com> (raw)
In-Reply-To: <3719.1088569577@sss.pgh.pa.us>
References: <40E1E1A9.8080207@fastmail.fm>
	<40E1ECEF.5090007@joeconway.com>
	<3318.1088567114@sss.pgh.pa.us>
	<40E23F72.4000108@joeconway.com>
	<3719.1088569577@sss.pgh.pa.us>

Tom Lane wrote:
> Um.  Sooner or later we ought to do something about the whole
> automatic-casting-to-and-from-text issue.  Datatypes shouldn't have to
> supply both I/O procedures and text cast procedures.

I thought automatic (i.e. implicit) casting-to-and-from-text was a no-no 
because it could cause strange and unintended conversion to take place, 
no? I do believe that explict casting to text should be allowed -- the 
result of any OUT function can be represented as text, can't it? A 
C-language version of the following should do it:

create or replace function any2text(anyelement) returns text as '
  begin
   return $1;
  end;
' language plpgsql;

And if we could cast text to cstring, it could be the input of any IN 
function. Hmmm, I guess you can cast any literal to cstring though:

select int4in('1'::cstring);
  int4in
--------
       1
(1 row)


> Right, in the short term you can make it work inside a plpgsql function,
> since plpgsql is pretty darn lax about casting.  But it'd be nice if it
> worked more generally.
> 

So what would that look like, and still be "safe".

Joe





view thread (13+ messages)  latest in thread

Message-ID: <40E24551.3080606@joeconway.com>
Permalink:  ../40E24551.3080606@joeconway.com/
Also on:    postgresql.org/message-id/40E24551.3080606@joeconway.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, jdenisgiguere@fastmail.fm
  Subject: Re: grant execute on many functions
  In-Reply-To: <40E24551.3080606@joeconway.com>
  References: <40E1E1A9.8080207@fastmail.fm> <40E1ECEF.5090007@joeconway.com> <3318.1088567114@sss.pgh.pa.us> <40E23F72.4000108@joeconway.com> <3719.1088569577@sss.pgh.pa.us> <40E24551.3080606@joeconway.com>

* 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