Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qp8IE-004UJQ-7k for pgsql-novice@arkaria.postgresql.org; Sat, 07 Oct 2023 14:28:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qp8IB-00HWHB-HS for pgsql-novice@arkaria.postgresql.org; Sat, 07 Oct 2023 14:28:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qp8IB-00HWH3-0P for pgsql-novice@lists.postgresql.org; Sat, 07 Oct 2023 14:28:32 +0000 Received: from mout.gmx.net ([212.227.15.15]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qp8I8-000U7Y-Co for pgsql-novice@lists.postgresql.org; Sat, 07 Oct 2023 14:28:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.com; s=s31663417; t=1696688905; x=1697293705; i=lazyvirus@gmx.com; bh=lm4ew7TCL571kjYtulUFBzsMMJ/qXzZPN/KWevNBxPc=; h=X-UI-Sender-Class:Date:From:To:Subject:In-Reply-To:References; b=e7dNlHab09eKiVvXlklIzLEti3Bdtby0l33++PPmSgR6QYvKVYj212EJObvUNultgIueskagJH0 Wns6VyvQyAFd+n4JiBPPeqeG70s55HDN90VFR60+D6onkBzJdLi53NiJmDW067ECvPkWp6Vhd0Yls DP2hj2fBKcvOj9dOgQXogOa03oaIlrcg7R9cKtSjHcIGmEu/E7+oDo3iwNAdgokj+eIvnuXw8Ovq2 jFZHQnK9pKTdHUCV9xbj+myn+wixQVL69kDarFgYSbcCqVc7wbwe/xpyB1Y91jgOkBUB3izzxDibG 6DcoappqrqrqfybbjCQHeYsCDFhkMWfYl8tA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mail.defcon1.lan ([93.15.31.113]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MJE6L-1r97sg1895-00KdFW for ; Sat, 07 Oct 2023 16:28:25 +0200 Date: Sat, 7 Oct 2023 16:28:23 +0200 From: Bzzzz To: pgsql-novice@lists.postgresql.org Subject: Re: Is `DATE` a function? Message-ID: <20231007162823.6c5929c9@msi.defcon1.lan> In-Reply-To: References: Organization: Anyone, anywhere but in banana demokratik republik of france or UERSS. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:f0EvZu3u+lNztr56PYF+2LmhTOxCFbZytDHYMtGsLlCDgvypLOw Dtg6tSOdFyythmvofHDbVUu5WCek3AHXVdwlHE4HxwWFujigxhrAMtYTELzrEzCaAmap0rG ySRLWR0rwHe3+yK7Jg2gr3Tdvrro2lFD7QLwudKxFY3+JBSAzkQQQ17UddDDVslplnCJ6V5 dGAXOwM1WxnDu/0OS75pQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:49cDKQjnpZM=;0ZvsUtMksWvEev7yzsSBAMXa4x+ Zn3q8vpgx4FhmgQ77rSDwog/eRMexo1k8RJJEYD8CZHOtFZAc5ZOxCS8wUAkSL1dbn/lStxgY gixBlDMurWZngxI9yTGlAtsRjHK2aB1DtzEL3UOvujeVciWxeq8f6yu8aKKyGAGkPlBtEpc6Z QmFF9E/A1R/7de1jjajQdQZHh5zSgJK0B85E8VxGHrXmrQcFrxs4uKLzl7qzX9u++aYun/QFB MyzQquKB431waDHC10+eHajbuWxO0v3N+gofWhNM9/tnIavie9empwNX12cLrrCWEfAR2gPhy CgWJIyhiYwTBSTGZS+sSeSgjvV/TiRxykXmxNa/ejxF6aLEXMg9Ib3hu0C3b6f90Dft2LzEmG iWjBnmUHKPrchiP1D01sru9aZ+/0p9waL1Sin3KyupoX06avQ8tziq0L4IbVQrvC6Rqb2BNZl /oqyfc25lzMUWtaJPnhel95281gxe/6reodz4sQjvKFsJGfoglJKl4ZXN1FZA78UiUTMarkW2 GewxmUOEbvg/cOJhw9SxYyoBvihrOiZ9gz50I2FmzDafbm1S5mVBbojq6o4Z7KuFgTAnEWCva ncNDmH/vO4j1Xa2ifnjvU5rltUer9mq06DeMCe7JY9cL/ytWT70qS2AdwRlWdLddilEJDudhA MTShKJyVQy8ixmSfdjZSYW+zmgqLQVzoSHhFSlJthXqOjYi461oCnHrSgCDVS7+SzJhyz3GxP 8/j8oF8ysiFsUDj+V31SeINZRjiASY1OKnfNknl9qSq3Rmh9mbqYfJCkxi9w7UDWORveRGRT9 cwSiZEQF8cpkf4mvARUliU6T/bJFTue6GZ7TrwfvNcbEozys6OZFMifPSBgr0Ip8xiZpucPZ3 etlYY67b7zEHfm/RlkizHcKVcbe0whxoNmyvfbQrXA2mpJzYxOOV1exLRJ9Db2jzKZF6ra131 6smU4g== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 7 Oct 2023 21:01:59 +0800 jinser wrote: Hi, > Hello, Friends, > > Use it like a normal function: > > playground=3D# 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=3D# 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=3D# 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-DA= TETIME-TABLE) > doesn't mention this... > If I missed it, where should I find the description? Or maybe it > actually should be in this table? Is is both a function and an operator, but the function has an arity of one (text, representing a date, timestamp, etc), hence the error message you've got. If you just want to get today's date, use : SELECT current_date; or if you want to twist your mind : SELECT date(now()); Jean-Yves