Search Postgresql Archives

Re: JSONB filed with default JSON from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 13, 2018 at 12:56 PM mrcasa bengaluru <mrcasablr@xxxxxxxxx> wrote:
>>
>> I assume that you could declare the column as
>>
>> address jsonb not null default 'your json here'::jsonb;
>
>
> 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.

1) Stick the default json in a table somewhere, say default_json with
one row, one column
2) Wrap the table with a function, default_json() that returns the
value from the table
3) Make a default function for the table, DEFAULT default_json().
That way you externalize the default into the database

merlin




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux