We're updating the issue view to help you get more done. 

Register postgres random() function as "rand" in PostgresSQLDialect

Description

I have an HQL query which uses "order by rand()". This works fine in our local integration tests (which are run against hsqldb), but fails against our build integration tests which runs postgres.
The reason the query fails is because postgres function for "rand" is called "random". We can workaround this by dynamically detecting the db driver and generating db specific queries, but it strikes me that the cleanest solution for this is to simply re-register postgres' random function as "rand" in the PostgresSQLDialect, i.e.

registerFunction( "random", new NoArgSQLFunction("random", Hibernate.DOUBLE) );
registerFunction( "rand", new NoArgSQLFunction("random", Hibernate.DOUBLE) );

Environment

Postgres 8.3

Status

Assignee

Brett Meyer

Reporter

Stephen Cresswell

Components

Fix versions

Affects versions

3.2.5

Priority

Trivial