Re: Is `DATE` a function?

From: Cory Albrecht <cory(at)albrecht(dot)name>
To: jinser <aimer(at)purejs(dot)icu>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Is `DATE` a function?
Date: 2023-10-16 15:42:49
Message-ID: CAMW5rYLbjRn_WL8kGQDbt6CtivFnFNJyavZRAvXidgEEHDt-YA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Rather than `SELECT DATE();` you likely want `SELECT NOW();`

On Sat, Oct 7, 2023, 09:20 jinser <aimer(at)purejs(dot)icu> 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.
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ibrahim Shaame 2023-10-17 08:18:20 Re: Reporting by family tree
Previous Message swastik Gurung 2023-10-16 13:29:32 Re: Reporting by family tree