Re: JSONB filed with default JSON from a file

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: mrcasablr(at)gmail(dot)com, Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: JSONB filed with default JSON from a file
Date: 2018-08-13 18:11:14
Message-ID: 23116.1534183874@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Mon, Aug 13, 2018 at 12:56 PM mrcasa bengaluru <mrcasablr(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2018-08-13 18:52:45 Re: JSONB filed with default JSON from a file
Previous Message Merlin Moncure 2018-08-13 18:00:56 Re: JSONB filed with default JSON from a file