Addition and subtraction operations for the interval and integer types

Started by yangyz2 months ago3 messageshackers
Jump to latest
#1yangyz
1197620467@qq.com

Hi Hackers,

When working on Oracle compatibility-related tasks, I discovered that
PostgreSQL does not support the addition and subtraction operations
between interval and integer (such usage is usually seen when performing
time calculations in Oracle). In order to enhance the compatibility 
between Oracle and PostgreSQL, I implemented it.

Regards,

Yang Yuanzhuo

Attachments:

v1-0002-Addition-and-subtraction-operations.patchapplication/octet-stream; charset=utf-8; name=v1-0002-Addition-and-subtraction-operations.patchDownload+153-1
#2David G. Johnston
david.g.johnston@gmail.com
In reply to: yangyz (#1)
Re: Addition and subtraction operations for the interval and integer types

On Wednesday, February 25, 2026, yangyz <1197620467@qq.com> wrote:

In order to enhance the compatibility
between Oracle and PostgreSQL, I implemented it.

This isn’t all that appealing to me. There isn’t really a goal of
increased compatibility’s aside from with the SQL Standard (extensions can
accept that burden IMO). And the utility of preventing people from having
to explicitly write the word ‘day’ is marginal. And given the already
numerous ways to combine data types in date/time I hesitate to add yet more.

David J.

#3Bernd Helmle
mailings@oopsware.de
In reply to: David G. Johnston (#2)
Re: Addition and subtraction operations for the interval and integer types

Hi,

Am Mittwoch, dem 25.02.2026 um 23:30 -0700 schrieb David G. Johnston:

On Wednesday, February 25, 2026, yangyz <1197620467@qq.com> wrote:

  In order to enhance the compatibility
between Oracle and PostgreSQL, I implemented it.

This isn’t all that appealing to me.  There isn’t really a goal of
increased compatibility’s aside from with the SQL Standard
(extensions can
accept that burden IMO).  And the utility of preventing people from
having
to explicitly write the word ‘day’ is marginal.  And given the
already
numerous ways to combine data types in date/time I hesitate to add
yet more.

And there's the orafce extension[1]https://github.com/orafce/orafce which adds extensive oracle
datetime compatibility to Postgres (including a more or less compatible
oracle.date type). This is far more useful since it also adds many of
the Oracle functions for datetime operations, too (like sysdate, ...).

[1]: https://github.com/orafce/orafce

--
Thanks,
Bernd