Search Postgresql Archives

Re: COPY with composite type column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il Wednesday 26 December 2007 12:58:34 Reg Me Please ha scritto:
> Hi all.
>
> I have this composite type:
>
> create type ct as (
>   ct1 text,
>   ct2 int
> );
>
> Then I have this table
>
> create table atable (
>   somedata numeric,
>   otherdata text,
>   compo ct
> );
>
> when I try to COPY data to that table and use the following "query"
> I get a syntax error message:
>
> COPY atable( somedata,(ct).ct1 ) from stdin;
> ERROR:  syntax error at or near "("
> LINE 1: COPY atable( somedata,(ct).ct1 ) from stdin;
>                               ^
>
> The "caret" points to the open parenthesis in "(ct)".
> Same error is reported on the first open parenthesis if I write
> "((ct.).ct1)".
>
> Any hint on how to write this COPY?

OK.
I've managed to walk the first step.
The correct grammar is

COPY atable( somedata,ct ) FROM STDIN;

That is you have to consider the full composed type column.
As stated into the COPY manual.
The data to be entered for the composed type column is to be enclosed within
paretheses. The single sub-columns are to be comma separated (!).

Is there a way to just enter some of the composed types composing columns?

-- 
Reg me, please!

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux