pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Followup from yesterday's PL/pgSQL fun...
9+ messages / 2 participants
[nested] [flat]

* Followup from yesterday's PL/pgSQL fun...
@ 2003-05-14 16:41 Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Larry Rosenman @ 2003-05-14 16:41 UTC (permalink / raw)
  To: pgsql-sql

I posted:

Also, this is what I wound up with for that line, which seems ugly, because
it couldn't find a quote_literal(inet) without the ::text on it:

  quote_literal(NEW.netblock::inet::text) ;


Is that right?



Can I ask 3 questions:

1) should quote_literal find a ::text conversion on it's own?
2) can text(cidr) be added to the default pg_cast table?
3) how can I add text(cidr) myself?



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749






^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
@ 2003-05-14 16:58 ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2003-05-14 16:58 UTC (permalink / raw)
  To: Larry Rosenman <ler@lerctr.org>; +Cc: pgsql-sql

Larry Rosenman <ler@lerctr.org> writes:
> 1) should quote_literal find a ::text conversion on it's own?

It won't, because the pg_cast entry for inet->text is marked "explicit
casts only".  In general I don't like implicit casts across datatype
categories, and am hoping to move in the direction of marking more such
casts as explicit-only.

> 2) can text(cidr) be added to the default pg_cast table?

I'll make that happen for 7.4.

> 3) how can I add text(cidr) myself?

Read the pg_cast description in 
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=catalogs.html
Insert a suitable row.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-05-14 17:02   ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2003-05-14 17:02 UTC (permalink / raw)
  To: Larry Rosenman <ler@lerctr.org>; pgsql-sql

I said:
> Larry Rosenman <ler@lerctr.org> writes:
>> 3) how can I add text(cidr) myself?

> Read the pg_cast description in 
> http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=catalogs.html
> Insert a suitable row.

Actually, I think you can do it with CREATE CAST.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-05-14 17:03     ` Larry Rosenman <ler@lerctr.org>
  2003-05-14 17:08       ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Larry Rosenman @ 2003-05-14 17:03 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql



--On Wednesday, May 14, 2003 13:02:48 -0400 Tom Lane <tgl@sss.pgh.pa.us> 
wrote:

> I said:
>> Larry Rosenman <ler@lerctr.org> writes:
>>> 3) how can I add text(cidr) myself?
>
>> Read the pg_cast description in
>> http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=catalogs
>> .html Insert a suitable row.
>
> Actually, I think you can do it with CREATE CAST.
The issue (for me) was decoding the function name(s).

I wish there was a \ command to display pg_cast...

LER

>
> 			regards, tom lane



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749






^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
@ 2003-05-14 17:08       ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:03         ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2003-05-14 17:08 UTC (permalink / raw)
  To: Larry Rosenman <ler@lerctr.org>; +Cc: pgsql-sql

Larry Rosenman <ler@lerctr.org> writes:
>> Actually, I think you can do it with CREATE CAST.

> The issue (for me) was decoding the function name(s).

I find the 7.3 OID-alias types very helpful for this sort of thing:

regression=# select castsource::regtype, casttarget::regtype, castfunc::regprocedure, castcontext from pg_cast limit 1;
 castsource | casttarget |   castfunc   | castcontext
------------+------------+--------------+-------------
 bigint     | smallint   | int2(bigint) | a
(1 row)

> I wish there was a \ command to display pg_cast...

There is (\dC).  But it's not very bright --- I don't think you can
limit the rows displayed at all.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 17:08       ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-05-14 18:03         ` Larry Rosenman <ler@lerctr.org>
  2003-05-14 18:13           ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Larry Rosenman @ 2003-05-14 18:03 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql



--On Wednesday, May 14, 2003 13:08:23 -0400 Tom Lane <tgl@sss.pgh.pa.us> 
wrote:

> Larry Rosenman <ler@lerctr.org> writes:
>>> Actually, I think you can do it with CREATE CAST.
>
>> The issue (for me) was decoding the function name(s).
>
> I find the 7.3 OID-alias types very helpful for this sort of thing:
>
> regression=# select castsource::regtype, casttarget::regtype,
> castfunc::regprocedure, castcontext from pg_cast limit 1;  castsource |
> casttarget |   castfunc   | castcontext
> ------------+------------+--------------+-------------
>  bigint     | smallint   | int2(bigint) | a
> (1 row)
>
>> I wish there was a \ command to display pg_cast...
>
> There is (\dC).  But it's not very bright --- I don't think you can
> limit the rows displayed at all.
$ psql
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

ler=# \dC
Did not find any relation named "C".
ler=#

Hrm.
>
> 			regards, tom lane



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749






^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 17:08       ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:03         ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
@ 2003-05-14 18:13           ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:14             ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2003-05-14 18:13 UTC (permalink / raw)
  To: Larry Rosenman <ler@lerctr.org>; +Cc: pgsql-sql

Larry Rosenman <ler@lerctr.org> writes:
> --On Wednesday, May 14, 2003 13:08:23 -0400 Tom Lane <tgl@sss.pgh.pa.us> 
> wrote:
>>> I wish there was a \ command to display pg_cast...
>> 
>> There is (\dC).  But it's not very bright --- I don't think you can
>> limit the rows displayed at all.

> ler=# \dC
> Did not find any relation named "C".

Mph.  It's there in CVS tip ... must have been added since 7.3.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 17:08       ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:03         ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 18:13           ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-05-14 18:14             ` Larry Rosenman <ler@lerctr.org>
  2003-05-14 18:16               ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Larry Rosenman @ 2003-05-14 18:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql



--On Wednesday, May 14, 2003 14:13:12 -0400 Tom Lane <tgl@sss.pgh.pa.us> 
wrote:

> Larry Rosenman <ler@lerctr.org> writes:
>> --On Wednesday, May 14, 2003 13:08:23 -0400 Tom Lane <tgl@sss.pgh.pa.us>
>> wrote:
>>>> I wish there was a \ command to display pg_cast...
>>>
>>> There is (\dC).  But it's not very bright --- I don't think you can
>>> limit the rows displayed at all.
>
>> ler=# \dC
>> Did not find any relation named "C".
>
> Mph.  It's there in CVS tip ... must have been added since 7.3.
C'est la vie.  That means maybe it can be smartened up to do limiting?

:-)


-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749






^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Followup from yesterday's PL/pgSQL fun...
  2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 16:58 ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:02   ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 17:03     ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 17:08       ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:03         ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
  2003-05-14 18:13           ` Re: Followup from yesterday's PL/pgSQL fun... Tom Lane <tgl@sss.pgh.pa.us>
  2003-05-14 18:14             ` Re: Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
@ 2003-05-14 18:16               ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2003-05-14 18:16 UTC (permalink / raw)
  To: Larry Rosenman <ler@lerctr.org>; +Cc: pgsql-sql

Larry Rosenman <ler@lerctr.org> writes:
>>> There is (\dC).  But it's not very bright --- I don't think you can
>>> limit the rows displayed at all.

> C'est la vie.  That means maybe it can be smartened up to do limiting?

If someone can think of a reasonable way.  The other \d commands all use
wildcard patterns to match against object names ... but a cast hasn't
got a name, really.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2003-05-14 18:16 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 16:41 Followup from yesterday's PL/pgSQL fun... Larry Rosenman <ler@lerctr.org>
2003-05-14 16:58 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-05-14 17:02   ` Tom Lane <tgl@sss.pgh.pa.us>
2003-05-14 17:03     ` Larry Rosenman <ler@lerctr.org>
2003-05-14 17:08       ` Tom Lane <tgl@sss.pgh.pa.us>
2003-05-14 18:03         ` Larry Rosenman <ler@lerctr.org>
2003-05-14 18:13           ` Tom Lane <tgl@sss.pgh.pa.us>
2003-05-14 18:14             ` Larry Rosenman <ler@lerctr.org>
2003-05-14 18:16               ` Tom Lane <tgl@sss.pgh.pa.us>

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