pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: raf <raf@raf.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to set up a schema default date to '2020-01-01'?
Date: Tue, 10 Nov 2020 16:36:20 +1100
Message-ID: <20201110053620.x7umaqli5tenfj4w@raf.org> (raw)
In-Reply-To: <CACh77r65RJU0+YDZWxbwEuGU6gYf18AUjXcijRrqN+YNm=d0Qw@mail.gmail.com>
References: <CACh77r7hKnujiWPQo03+OND5kdR0nUec86+6eA62RgeDzA4nuA@mail.gmail.com>
	<CAKFQuwZFO2tYS2aXLEUSod14qjE47Ji+pQsV73mZ0fT5bGB50A@mail.gmail.com>
	<CACh77r65RJU0+YDZWxbwEuGU6gYf18AUjXcijRrqN+YNm=d0Qw@mail.gmail.com>

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

> On Mon, Nov 9, 2020 at 9:44 PM David G. Johnston <david.g.johnston@gmail.com>
> wrote:
> 
> > On Mon, Nov 9, 2020 at 9:08 AM mark armon <1994hejian@gmail.com> 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






view thread (5+ messages)

Message-ID: <20201110053620.x7umaqli5tenfj4w@raf.org>
Permalink:  ../20201110053620.x7umaqli5tenfj4w@raf.org/
Also on:    postgresql.org/message-id/20201110053620.x7umaqli5tenfj4w@raf.org

 · 

reply

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: raf@raf.org
  Subject: Re: How to set up a schema default date to '2020-01-01'?
  In-Reply-To: <20201110053620.x7umaqli5tenfj4w@raf.org>
  References: <CACh77r7hKnujiWPQo03+OND5kdR0nUec86+6eA62RgeDzA4nuA@mail.gmail.com> <CAKFQuwZFO2tYS2aXLEUSod14qjE47Ji+pQsV73mZ0fT5bGB50A@mail.gmail.com> <CACh77r65RJU0+YDZWxbwEuGU6gYf18AUjXcijRrqN+YNm=d0Qw@mail.gmail.com> <20201110053620.x7umaqli5tenfj4w@raf.org>

* 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