Search Postgresql Archives

Re: How to set up a schema default date to '2020-01-01'?

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

 



On Tue, Nov 10, 2020 at 10:51:02AM +0530, mark armon <1994hejian@xxxxxxxxx> wrote:

> On Mon, Nov 9, 2020 at 9:44 PM David G. Johnston <david.g.johnston@xxxxxxxxx>
> wrote:
> 
> > On Mon, Nov 9, 2020 at 9:08 AM mark armon <1994hejian@xxxxxxxxx> wrote:
> >
> >> How to set up a schema default date (now) to '2020-01-01'?  Whatever
> >> timezone would be OK.
> >
> > What is a "schema default" (date or otherwise)?
>
> > David J.
> >
> like I create a schema: test, I want the default date to 2020-01-01, so
> when I do
> 
> select test.now;
> 
> the result is 2020-01-01

I would recommend that you create a stored
function/procedure that returns the "default" that you
want it to return, and execute a call to that, rather
than executing "select test.now". The statement "select
test.now" doesn't even seem to be valid sql. Bear in
mind that I have no idea what you are talking about so
my advice might not be helpful.

I have timestamped database backups and timestamped
schema update files so that my database load script
knows which schema updates to apply when loading an old
database backup (i.e. anything whose timestamp is later
than the timestamp of the backup), which seems like it
might be related to what you are after, but I don't
understand the idea of a "default" date. The "date" for
my schema is always the present so as to match the
corresponding software in its current state.

Perhaps you can explain in more detail what you are
after.

cheers,
raf






[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