date_part/extract parse curiosity

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: date_part/extract parse curiosity
Date: 2022-10-20 12:45:50
Message-ID: 1d5ff26f-f122-169b-eeff-abbaced85838@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that
select date_part('millennium', now()); --> 3

will execute also, unperturbed, in this form:
select date_part('millennium xxxxx', now()); --> 3

By the same token

select extract(millennium from now()) --> 3
select extract(millenniumxxxxxxxxx from now()) --> 3

This laxness occurs in all releases, and with 'millennium',
'millisecond', and 'microsecond' (at least).

Even though it's not likely to cause much real-life headaches, and I
hesitate to call it a real bug, perhaps it would be better if it could
be a bit stricter.

Thanks,

Erik Rijkers

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-10-20 13:47:38 Re: Logical WAL sender unresponsive during decoding commit
Previous Message Ants Aasma 2022-10-20 11:44:40 Re: Standby recovers records from wrong timeline