From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: mrcasablr@gmail.com
Cc: Charles Clavadetscher <clavadetscher@swisspug.org>
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: JSONB filed with default JSON from a file
Date: Mon, 13 Aug 2018 14:11:14 -0400
Message-ID: <23116.1534183874@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHyXU0zcM_S+7CtObiSEUr0W1COue6LcjSvDz4u7w-NPUexfjw@mail.gmail.com>
References: <CALpZ+ORgw=ZjZDBJ32E4ucuZBtVnHEHQ4=GM2Ex+w378QwBAXQ@mail.gmail.com>
<7D710F90-3332-497E-9390-54B1F302961B@swisspug.org>
<CALpZ+OStrE8EC51KgChTd4HTvd50LSXatHzCqLuUdK0_pdfANQ@mail.gmail.com>
<CAHyXU0zcM_S+7CtObiSEUr0W1COue6LcjSvDz4u7w-NPUexfjw@mail.gmail.com>
Merlin Moncure <mmoncure@gmail.com> writes:
> On Mon, Aug 13, 2018 at 12:56 PM mrcasa bengaluru <mrcasablr@gmail.com> wrote:
>> Thanks! However, this involves writing the entire JSON in the schema file looks inconvenient. I was hoping I would be able to reference to an external 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, mrcasablr@gmail.com, clavadetscher@swisspug.org
Subject: Re: JSONB filed with default JSON from a file
In-Reply-To: <23116.1534183874@sss.pgh.pa.us>
References: <CALpZ+ORgw=ZjZDBJ32E4ucuZBtVnHEHQ4=GM2Ex+w378QwBAXQ@mail.gmail.com> <7D710F90-3332-497E-9390-54B1F302961B@swisspug.org> <CALpZ+OStrE8EC51KgChTd4HTvd50LSXatHzCqLuUdK0_pdfANQ@mail.gmail.com> <CAHyXU0zcM_S+7CtObiSEUr0W1COue6LcjSvDz4u7w-NPUexfjw@mail.gmail.com> <23116.1534183874@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox