From: <fab...@us...> - 2008-07-22 22:44:06
|
Revision: 3651 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3651&view=rev Author: fabiomaulo Date: 2008-07-22 22:44:13 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Merge r3650 (fix NH-1390 by David Bachmann) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2008-07-22 22:41:57 UTC (rev 3650) +++ trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2008-07-22 22:44:13 UTC (rev 3651) @@ -2,6 +2,7 @@ using NHibernate.Cfg; using NHibernate.Dialect.Function; using NHibernate.SqlCommand; +using NHibernate.SqlTypes; namespace NHibernate.Dialect { @@ -137,5 +138,31 @@ { return ForUpdateString + " of " + aliases; } + + /// <summary>PostgreSQL supports UNION ALL clause</summary> + /// <remarks> + /// Reference: <see href="http://www.postgresql.org/docs/8.0/static/sql-select.html#SQL-UNION"> + /// PostgreSQL 8.0 UNION Clause documentation</see> + /// </remarks> + /// <value><see langword="true"/></value> + public override bool SupportsUnionAll + { + get { return true; } + } + + /// <summary>PostgreSQL requires to cast NULL values to correctly handle UNION/UNION ALL</summary> + /// <remarks> + /// See <see href="http://archives.postgresql.org/pgsql-bugs/2005-08/msg00239.php"> + /// PostgreSQL BUG #1847: Error in some kind of UNION query.</see> + /// </remarks> + /// <param name="sqlType">The <see cref="DbType"/> type code.</param> + /// <returns>null casted as <paramref name="sqlType"/>: "<c>null::sqltypename</c>"</returns> + public override string GetSelectClauseNullString(SqlType sqlType) + { + //This will cast 'null' with the full SQL type name, including eventual parameters. + //It shouldn't have any influence, but note that it's not mandatory. + //i.e. 'null::decimal(19, 2)', even if 'null::decimal' would be enough + return "null::" + GetTypeName(sqlType); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |