Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zuph3-0004YH-J6 for pgsql-sql@arkaria.postgresql.org; Fri, 06 Nov 2015 22:41:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zuph1-0008U0-FP for pgsql-sql@arkaria.postgresql.org; Fri, 06 Nov 2015 22:41:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zuph1-0008Tt-08 for pgsql-sql@postgresql.org; Fri, 06 Nov 2015 22:41:11 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zupgx-0003jE-0H for pgsql-sql@postgresql.org; Fri, 06 Nov 2015 22:41:10 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id DA6D9202FF for ; Fri, 6 Nov 2015 17:41:04 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 06 Nov 2015 17:41:04 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=k9X6j1CMfzAKFOF2yGSTqaZzV3s=; b=Zf+tIz /kmAHSDUEEmfDvjAOjmw+XwtISFHey/Bbq4bFWJYsvyO5Rzbu0PsELjIRtqqVI9Q Pl9eU5ZyWZLQYkH8cgsxXNPwgJXW1h0ZidSkZ8UdS6u4SXwPWB2CTj7KTfvFgOwm b1bvrUmjvQRyEp8SeB6BRjLv+FTYxwpQyeAqM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=k9X6j1CMfzAKFOF 2yGSTqaZzV3s=; b=YOvQ8PzKFcHJHyX74BnBVqPzt9TvNtXleWVy6LDLrVj51g5 IdvJESGuFbKQCWsP7Hajj97Siklxb97V+WpAsch2uZMKdBoeJd9fah28fpAPku8e 9CtPBtEf9kbmK1dYM3llHm+8FnvbRA4c3uCU8hMjYnndq38RkTn/fHzu3vbM= X-Sasl-enc: wPKqQvxQmFYPUw+AWcj3kXHJgPYw9julqett4KaqhMFD 1446849664 Received: from [192.168.1.2] (65-102-182-223.tukw.qwest.net [65.102.182.223]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A39B6800F7; Fri, 6 Nov 2015 17:41:04 -0500 (EST) Subject: Re: query option in COPY postgres To: masyaf , pgsql-sql@postgresql.org References: <1446841356122-5873015.post@n5.nabble.com> From: Adrian Klaver Message-ID: <563D2C74.8050408@aklaver.com> Date: Fri, 6 Nov 2015 14:40:52 -0800 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1446841356122-5873015.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 11/06/2015 12:22 PM, masyaf wrote: > According to COPY documentation , I can use query option when exporting data. > Can I use query VALUES when loading data into tables from txt file? If I > have 2 columns and I want to insert record manually in the first > column(SentenceID) and insert data in the second column(Sentence) from text > file. Is it something like: > > copy foo1(Sentence) | (VALUES (2339)) from '/path/to/sentence.txt' with > delimiter '*'; In addition to what David posted, in Postgres 9.3+ you have option of doing COPY FROM a program instead of a file. This opens the possibility of using an external program to get your data into the form and order you need and then have COPY pull from that. > > How to use exactly options in COPY command, it has {} | [] symbols in > documentation. > > > > -- > View this message in context: http://postgresql.nabble.com/query-option-in-COPY-postgres-tp5873015.html > Sent from the PostgreSQL - sql mailing list archive at Nabble.com. > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql