Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBEHu-00A082-Do for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 13:19:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rBEHs-0009rT-EC for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 13:19:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBEHr-0009qt-UN for pgsql-hackers@lists.postgresql.org; Thu, 07 Dec 2023 13:19:32 +0000 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rBEHj-00AZ3j-VJ for pgsql-hackers@postgresql.org; Thu, 07 Dec 2023 13:19:30 +0000 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b844357f7cso693188b6e.1 for ; Thu, 07 Dec 2023 05:19:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1701955161; x=1702559961; darn=postgresql.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=r12Md2ua0PRnM7DbBFqOidjy2Z65yHUj0ZrgO8QhKUY=; b=cV4Tz3/qDmthrZFTV8BbExkqKcPRtv4p6iGd2hSbhhsBVF0rKMQWJ162PMmG8kA/Zc J22gECuP9kaTJJdAkhSNJgJBn/aPGPzYkzJE6B6Q6mTaYCKNEizgjn8UyIRtIE5dEe2k Bs5L6Qya5owLXpslTo8sPi1Jbt3B9WyZsDty8TbbcMznXdi89NzCLigfg4OZNaKuU7Cu m3T0pJxxpBQRYdbncD6UyonXC2802TdYhwqY+kdHV0uLhL/OkPtAHOFOU0IMk0jFNS5/ s3NCK2Xpv21UjigojcgZNxt/nsG5VYxGa43IGQB6a64VjAHbyW/Rip5raf9qXWU3Gj8a OuYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701955161; x=1702559961; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=r12Md2ua0PRnM7DbBFqOidjy2Z65yHUj0ZrgO8QhKUY=; b=T6v9LNyqn4YULRvdPHxt0YG85WxHU2TkTJRUDlgXQKtJ/APBMgwNDvQFJR3pKX5Dj5 iN0Zo0057vCPr4R3X5e0NxH+X6FMrJRr5ZzgJbk8wp8tBVDNCWERd4uuQVI1I80dy6o5 +rm3nHTj4qNogxomyS2jgTCb3fJclC7kn39WctxSr2r3TSid4J0SZsrO51hE18c1xFRs kwrfn1jyCYO/nL8WFSPgRXDkVMMT/zQhQNbZl3jQ1ZWad0eiB/QpClfQ/vK4EKmKA9Zr Ex/0tz+iGliMfvOkN8isbnvhsFdapSzT8NLt8nDBucFnjsIRLZrHR7SMg3XUDdf5QUCT ruxg== X-Gm-Message-State: AOJu0Yx07nw0FmR4/oMBUmLp9KwcD0nad4/o6ZVuCDfDtWGBAcs4ijNi QlN7YLWfH/QVFwOgujvW/+SjJw== X-Google-Smtp-Source: AGHT+IEuxgeVaAh2sdTqT+p8GpU7AuvxU55qAVbro+nVQa17xb92IM/WlW39ZukZN6ElwNqlcihtIg== X-Received: by 2002:a05:6808:1a0a:b0:3b9:d9d6:16ba with SMTP id bk10-20020a0568081a0a00b003b9d9d616bamr1961874oib.74.1701955160758; Thu, 07 Dec 2023 05:19:20 -0800 (PST) Received: from ?IPV6:2605:a601:91bc:f600::2bb? ([2605:a601:91bc:f600::2bb]) by smtp.googlemail.com with ESMTPSA id qk3-20020a05620a888300b007759a81d88esm385151qkn.50.2023.12.07.05.19.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 05:19:20 -0800 (PST) Content-Type: multipart/alternative; boundary="------------2RlHY3j00VqAXn30faEtUHVz" Message-ID: Date: Thu, 7 Dec 2023 08:19:19 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Emitting JSON to file using COPY TO Content-Language: en-US To: "David G. Johnston" , Joe Conway Cc: Sehrope Sarkuni , Tom Lane , Davin Shearer , PostgreSQL-development References: <46cc4507-a0d9-4044-b2ce-5a8bca8015c0@joeconway.com> <2554e520-e103-8978-dcb5-807dfeb77402@dunslane.net> <926ff917-8371-40ec-b5e6-ab7b0e09bdc5@joeconway.com> <315b81d4-4b67-7828-0355-3808cd14acd1@dunslane.net> <7a60faf6-e7f1-419d-aee6-10a78ea2fe81@joeconway.com> <2e7ff718-895d-83fc-46f7-be25e23b23b4@dunslane.net> <1104915.1701877459@sss.pgh.pa.us> <19a5f9d8-bd1f-9e51-0f5b-510c1189a8a7@dunslane.net> <4d5688f4-9582-4093-8448-e1867bc9e2bc@joeconway.com> <4ad29199-361f-4740-a919-12080ad5ed65@joeconway.com> From: Andrew Dunstan In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------2RlHY3j00VqAXn30faEtUHVz Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023-12-06 We 17:56, David G. Johnston wrote: > On Wed, Dec 6, 2023 at 3:38 PM Joe Conway wrote: > > So the questions are: > 1. Do those two formats work for the initial implementation? > > > Yes.  We provide a stream-oriented format and one atomic-import format. > > 2. Is the default correct or should it be switched >     e.g. rather than specifying FORCE_ARRAY to get an >     array, something like FORCE_NO_ARRAY to get JSON lines >     and the JSON array is default? > > > No default? > > Require explicit of a sub-format when the main format is JSON. > > JSON_OBJECT_ROWS > JSON_ARRAY_OF_OBJECTS > > For a future compact array-structured-composites sub-format: > JSON_ARRAY_OF_ARRAYS > JSON_ARRAY_ROWS > > No default seems unlike the way we treat other COPY options. I'm not terribly fussed about which format to have as the default, but I think we should have one. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------2RlHY3j00VqAXn30faEtUHVz Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2023-12-06 We 17:56, David G. Johnston wrote:
On Wed, Dec 6, 2023 at 3:38 PM Joe Conway <mail@joeconway.com> wrote:
So the questions are:
1. Do those two formats work for the initial implementation?

Yes.  We provide a stream-oriented format and one atomic-import format.

2. Is the default correct or should it be switched
    e.g. rather than specifying FORCE_ARRAY to get an
    array, something like FORCE_NO_ARRAY to get JSON lines
    and the JSON array is default?


No default?

Require explicit of a sub-format when the main format is JSON.

JSON_OBJECT_ROWS
JSON_ARRAY_OF_OBJECTS

For a future compact array-structured-composites sub-format:
JSON_ARRAY_OF_ARRAYS
JSON_ARRAY_ROWS



No default seems unlike the way we treat other COPY options. I'm not terribly fussed about which format to have as the default, but I think we should have one.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------2RlHY3j00VqAXn30faEtUHVz--