pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ice Planet <ice@adiemus.sk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Type conversion
Date: Tue, 20 Jun 2000 15:48:45 -0400
Message-ID: <1728.961530525@sss.pgh.pa.us> (raw)
In-Reply-To: <SAK.2000.06.20.ogetqkls@adiemus>
References: <SAK.2000.06.20.ogetqkls@adiemus>

Ice Planet <ice@adiemus.sk> writes:
> B: insert into t2 values (select int2(int4(b)) from t1 where a = 1)

Works for me when spelled correctly:

regression=# insert into t2 (select int2(int4(b)) from t1 where a = 1);
INSERT 314647 1

If you make a suitable conversion function then you can omit the
explicit conversion:

regression=# create function int2(int8) returns int2 as
regression-# 'begin return int2(int4($1)); end;' language 'plpgsql';
CREATE
regression=# insert into t2 (select b from t1 where a = 1);
INSERT 314649 1

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <1728.961530525@sss.pgh.pa.us>
Permalink:  ../1728.961530525@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1728.961530525@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ice@adiemus.sk
  Subject: Re: Type conversion
  In-Reply-To: <1728.961530525@sss.pgh.pa.us>

* 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