SCM

[#1011188] Fix for incorrect use of TimeSpan parameters in named arguments

View Trackers | Patches | Download .csv | Monitor

Date:
2012-04-25 15:39
Priority:
3
State:
Open
Submitted by:
Roman Starkov (rstarkov)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
 
Summary:
Fix for incorrect use of TimeSpan parameters in named arguments

Detailed description
Postgres allows expressions like this:

now() + E'15 days'

but not like this:

now() - E'15 days'

The latter results in the error "invalid input syntax for type timestamp with time zone".

The correct syntax is to either include the "INTERVAL" keyword before the string, or use the cast syntax:

now() - E'15 days'::interval

Since the parameter class already has support for inserting a cast, this patch makes use of that.

String objects are excluded from this logic for compatibility reasons: the current Npgsql allows one to use strings in place of, say, BIGINT parameters. An explicit cast to TEXT would break queries that rely on that.

Followup

No Followups Have Been Posted

Attached Files:

Attachments:
patch.diff

Changes:

Field Old Value Date By
File Added732: patch.diff2012-04-25 15:39rstarkov
Powered By FusionForge