using COPY and PARTITON

Started by cjm1010over 16 years ago5 messagesgeneral
Jump to latest
#1cjm1010
cjm1010@naver.com

hi~

I want to insert DATA by using the COPY making PARTITON TABLE. By the way,
DATA is inserted only in PARENT TABLE.
Can DATA be inserted in CHILD TABLE by using the COPY?

Thanks,

JM CHAE
--
View this message in context: http://www.nabble.com/using-COPY-and-PARTITON-tp24894446p24894446.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#2Scott Marlowe
scott.marlowe@gmail.com
In reply to: cjm1010 (#1)
Re: using COPY and PARTITON

I believe triggers can do it.

Show quoted text

On Sun, Aug 9, 2009 at 11:15 PM, cjm1010<cjm1010@naver.com> wrote:

hi~

I want to insert DATA by using the COPY making PARTITON TABLE.  By the way,
DATA is inserted only in PARENT TABLE.
Can DATA be inserted in CHILD TABLE by using the COPY?

#3cjm1010
cjm1010@naver.com
In reply to: Scott Marlowe (#2)
Re: using COPY and PARTITON

thanks for reply

I am using rules with libpq instead of triggers now.
When INSERT was used, it was possible to insert it in CHILD TABLE well.
However, if COPY is used, it is possible to insert it only in PARENT TABLE.
Can triggers be used with libpq?
And, if trigger is used, can it straighten out that problem?

JM CHAE

Scott Marlowe-2 wrote:

I believe triggers can do it.

On Sun, Aug 9, 2009 at 11:15 PM, cjm1010<cjm1010@naver.com> wrote:

hi~

I want to insert DATA by using the COPY making PARTITON TABLE.  By the
way,
DATA is inserted only in PARENT TABLE.
Can DATA be inserted in CHILD TABLE by using the COPY?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
View this message in context: http://www.nabble.com/using-COPY-and-PARTITON-tp24894446p24895140.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#4Wojtek
foo@twine.pl
In reply to: Scott Marlowe (#2)
Re: using COPY and PARTITON

Hi,

I'd recommend coping directly to child tables (partitions). It's much
faster.

Regards,
foo

Scott Marlowe wrote:

Show quoted text

I believe triggers can do it.

On Sun, Aug 9, 2009 at 11:15 PM, cjm1010<cjm1010@naver.com> wrote:

hi~

I want to insert DATA by using the COPY making PARTITON TABLE. By the way,
DATA is inserted only in PARENT TABLE.
Can DATA be inserted in CHILD TABLE by using the COPY?

#5Scott Marlowe
scott.marlowe@gmail.com
In reply to: cjm1010 (#3)
Re: using COPY and PARTITON

On Mon, Aug 10, 2009 at 12:58 AM, cjm1010<cjm1010@naver.com> wrote:

thanks for reply

I am using rules with libpq instead of triggers now.
When INSERT was used, it was possible to insert it in CHILD TABLE well.
However, if COPY is used, it is possible to insert it only in PARENT TABLE.
Can triggers be used with libpq?
And, if trigger is used, can it straighten out that problem?

Yep, triggers work just fine with libpq (if they didn't FK constraints
wouldn't work). I switched from rules to triggers a while back for my
reporting / stats database and they work a charm.