public inbox for [email protected]
help / color / mirror / Atom feedFrom: Cory Albrecht <[email protected]>
To: jinser <[email protected]>
Cc: [email protected]
Subject: Re: Is `DATE` a function?
Date: Mon, 16 Oct 2023 11:42:49 -0400
Message-ID: <CAMW5rYLbjRn_WL8kGQDbt6CtivFnFNJyavZRAvXidgEEHDt-YA@mail.gmail.com> (raw)
In-Reply-To: <CAK3STzGm-8_5yvyWm_SJALo1Wb1i3cMJrBj8=WPmVyxHdhmYrg@mail.gmail.com>
References: <CAK3STzGm-8_5yvyWm_SJALo1Wb1i3cMJrBj8=WPmVyxHdhmYrg@mail.gmail.com>
Rather than `SELECT DATE();` you likely want `SELECT NOW();`
On Sat, Oct 7, 2023, 09:20 jinser <[email protected]> wrote:
> Hello, Friends,
>
> Use it like a normal function:
>
> playground=# SELECT DATE();
> ERROR: function date() does not exist
> LINE 1: SELECT DATE();
> ^
> HINT: No function matches the given name and argument types. You
> might need to add explicit type casts.
>
> playground=# SELECT DATE('2022-01-13');
> date
> ------------
> 2022-01-13
> (1 row)
>
> Another reason I think this is a function is that other types don't
> seem to have the same behavior:
>
> playground=# SELECT integer('123');
> ERROR: syntax error at or near "("
> LINE 1: SELECT integer('123');
> ^
>
> The Table 9.33. Date/Time Functions in the documentation
> (
> https://www.postgresql.org/docs/16/functions-datetime.html#FUNCTIONS-DATETIME-TABLE
> )
> doesn't mention this...
> If I missed it, where should I find the description? Or maybe it
> actually should be in this table?
>
> Thanks in advance.
>
>
>
view thread (5+ messages)
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Is `DATE` a function?
In-Reply-To: <CAMW5rYLbjRn_WL8kGQDbt6CtivFnFNJyavZRAvXidgEEHDt-YA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox