Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpHJP-0005bl-J7 for pgsql-general@arkaria.postgresql.org; Mon, 13 Aug 2018 18:11:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpHJN-00038k-K0 for pgsql-general@arkaria.postgresql.org; Mon, 13 Aug 2018 18:11:25 +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.89) (envelope-from ) id 1fpHJN-00038d-CB for pgsql-general@lists.postgresql.org; Mon, 13 Aug 2018 18:11:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpHJG-0004Vt-K2 for pgsql-general@postgresql.org; Mon, 13 Aug 2018 18:11:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7DIBEJ3023117; Mon, 13 Aug 2018 14:11:14 -0400 From: Tom Lane To: Merlin Moncure cc: mrcasablr@gmail.com, Charles Clavadetscher , PostgreSQL General Subject: Re: JSONB filed with default JSON from a file In-reply-to: References: <7D710F90-3332-497E-9390-54B1F302961B@swisspug.org> Comments: In-reply-to Merlin Moncure message dated "Mon, 13 Aug 2018 13:00:56 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23115.1534183874.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 13 Aug 2018 14:11:14 -0400 Message-ID: <23116.1534183874@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Merlin Moncure writes: > On Mon, Aug 13, 2018 at 12:56 PM mrcasa bengaluru = wrote: >> Thanks! However, this involves writing the entire JSON in the schema fi= le looks inconvenient. I was hoping I would be able to reference to an ext= ernal JSON file which could be used for the default value. > [ put it in a table instead ] Yeah. If you really insist on having it in a file outside the database, you can, but you'll need a superuser-privileged function to read it from that file. Aside from the security aspects, this sort of thing is an antipattern because it opens you up to backup/restore problems ("oh, we needed that file too?"), replication problems, yadda yadda. And what are you buying by doing it like that? Better to keep it inside the DB instead. regards, tom lane