Skip site navigation (1) Skip section navigation (2)

Non-standard function names

From: Clive Page <cgp(at)star(dot)le(dot)ac(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Non-standard function names
Date: 2004-06-23 15:45:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
The developers of Postgres over the years are to be commended on their
support for SQL Standards, but one thing that has annoyed me for some time
is that the names of several mathematical functions are seriously
non-standard.  Postgres isn't actually flouting an SQL Standard in this
area as there isn't one as far as I can discover, but the JDBC
specification includes a number of function names, and most other DBMS use
the same ones, more-or-less.  I put together a small web page comparing
the function names in use in various products:

Here one can see that Postgres actually has 6 deviations from the de-facto
JDBC standard, more than any other DBMS I examined, while MySQL comes out
as the most conformant, surprisingly.

Four of these could be fixed easily, by allowing CEILING to be a synonym
for CEIL, and similarly POW for POWER, RAND for RANDOM, and TRUNCATE for
TRUNC.  Does anyone see any problems with doing that?  It would surely
help people porting applications over from other DBMS.

The problems come with LN and LOG which Postgres uses for logarithms to
base e and 10 respectively: the JDBC standard uses LOG and LOG10
respectively, so that any fix would mean LOG changed its meaning.  I don't
see an easy solution here; maybe both LOGE and LOG10 could be provided, at
least there would then be only one difference from the JDBC standard.

Clive Page
Dept of Physics & Astronomy,
University of Leicester,
Leicester, LE1 7RH,  U.K.


pgsql-sql by date

Next:From: StefDate: 2004-06-23 16:07:21
Subject: ERROR: Unable to format timestamp; internal coding error
Previous:From: Richard HuxtonDate: 2004-06-23 11:38:24
Subject: Re: sql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group