Обсуждение: Hers's one with the COPY command ...

Поиск
Список
Период
Сортировка

Hers's one with the COPY command ...

От
The Hermit Hacker
Дата:
I have a table created as:

=============
DROP TABLE referer_raw_data;
CREATE TABLE referer_raw_data (
        counter_id int4,
        referer_url_domain varchar(256),
        referer_counter int4,
        date_added datetime default now());
=============

I wish to copy a stream of data to it as:

5\thttp://thissite\t3\t...

where the date *isn't* part of the copy, since I want to set it as the
date that the record was added...is this possible?   now, from the docs, I
realize that it will ignore the default, which I'm okay with, but is there
a way of passing it now(), or something similar, to set the data?

basically, I want to stream web data to the backend as fast as the backend
will take it, with COPY TO being faster then INSERT INTO, but don't want
to have to "create a date" to insert at the same time...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Re: [GENERAL] Hers's one with the COPY command ...

От
Lincoln Yeoh
Дата:
I assume you are copying batches of data at the same time, so hardcoding in
the datetime wouldn't be a big problem right? Kludgy but should work.

Maybe if you did 'now' it might work. Or force it as 'now'::datetime.

Definitely not an expert- plenty to learn about SQL and Postgres, but since
no one has made any suggestions...

Cheerio,

Link.


At 09:07 PM 22-11-1999 -0400, you wrote:
>
>I have a table created as:
>
>=============
>DROP TABLE referer_raw_data;
>CREATE TABLE referer_raw_data (
>        counter_id int4,
>        referer_url_domain varchar(256),
>        referer_counter int4,
>        date_added datetime default now());
>=============
>
>I wish to copy a stream of data to it as:
>
>5\thttp://thissite\t3\t...
>
>where the date *isn't* part of the copy, since I want to set it as the
>date that the record was added...is this possible?   now, from the docs, I
>realize that it will ignore the default, which I'm okay with, but is there
>a way of passing it now(), or something similar, to set the data?
>
>basically, I want to stream web data to the backend as fast as the backend
>will take it, with COPY TO being faster then INSERT INTO, but don't want
>to have to "create a date" to insert at the same time...
>
>Marc G. Fournier                   ICQ#7615664               IRC Nick:
Scrappy
>Systems Administrator @ hub.org
>primary: scrappy@hub.org           secondary:
scrappy@{freebsd|postgresql}.org
>
>
>************
>
>
>