Re: Create Table Question...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jerry LeVan <jerry(dot)levan(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Create Table Question...
Date: 2011-01-31 16:55:39
Message-ID: 18338.1296492939@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jerry LeVan <jerry(dot)levan(at)gmail(dot)com> writes:
> Here is a fragment of sql that I frequently use:
> *************
> insert into checks (select *
> from dblink('select * from checks where date >=''1/1/2011''')
> as (date date,
> amount numeric(9,2),
> tranid text,
> source text,
> memo text,
> status text,
> category text
> ) );
> **************
> The stuff after the 'as' is a description of the
> rows of the table checks.

> Could I shortened the above by using the automatically created row type of
> the table checks?

Unfortunately not. It's not an unreasonable suggestion, though I'm not
sure how we'd fit it into the syntax. Maybe we could allow casting
to resolve the output type of the function, a la

select ... from dblink('query')::checks

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Herouth Maoz 2011-01-31 17:06:12 Re: Adding more space, and a vacuum question.
Previous Message Bryan Murphy 2011-01-31 16:40:33 Re: Hit by the out of memory killer last night