151945-03-12 14:42:14.56351-05
You can see the year is hugely out of scale. This is something we just noticed on Postgres 8.2.1 64 bit. We have the system set to store date-times as integers.
When the value is read back into .Net it displays properly (somehow), but it appears terribly wrong in postgres. We use a purchased copy of version 2.50.
Update: below is a server log of the call. You can see parameter $5 is not valid timestamptz.
Code: Select all
LOG: duration: 0.068 ms bind PRSTMT404779712537666500/PORTAL404779712537666500: SELECT * from subscription_add($1, $2, $3, $4, $5, $6, $7, $8) AS return_value
DETAIL: parameters: $1 = '1359035820', $2 = '94bf75b0-3dc1-4029-b129-9f823cdced00', $3 = '9e5fe88c-d469-4612-999f-572bd8a41348', $4 = 'http://blah', $5 = '151945-03-13 05:53:16.44234-05', $6 = 'owner data', $7 = 'httpBasic', $8 = 'f'
Code: Select all
CREATE OR REPLACE FUNCTION subscription_add(IN _hashkey integer, IN _subscriptionid character varying, IN _topicid character varying, IN _notifyaddress character varying, IN _expiration timestamp with time zone, IN _ownerdata character varying, IN _notifychannel character varying, IN _hasexpiration boolean, OUT _retval boolean) AS
Code: Select all
public bool add(string config, string _subscriptionid, string _topicid, string _notifyaddress, System.DateTime _expiration, string _ownerdata, string _notifychannel, bool _hasexpiration)
{
try
{
string hashSource = "eventpubsub:topic:" + _topicid.ToString();
Database db = CreateHashedDatabase(config, hashSource);
string sqlCommand = "subscription_add";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddInParameter(dbCommand, "_hashkey", DbType.Int32, _hashkey);
db.AddInParameter(dbCommand, "_subscriptionid", DbType.String, _subscriptionid);
db.AddInParameter(dbCommand, "_topicid", DbType.String, _topicid);
db.AddInParameter(dbCommand, "_notifyaddress", DbType.String, _notifyaddress);
db.AddInParameter(dbCommand, "_expiration", DbType.DateTime, _expiration);
db.AddInParameter(dbCommand, "_ownerdata", DbType.String, _ownerdata);
db.AddInParameter(dbCommand, "_notifychannel", DbType.String, _notifychannel);
db.AddInParameter(dbCommand, "_hasexpiration", DbType.Boolean, _hasexpiration);
db.AddOutParameter(dbCommand, "_retval", DbType.Boolean, 1);
db.ExecuteNonQuery(dbCommand);
return (bool)db.GetParameterValue(dbCommand, "_retval");
}
catch (Exception ex)
{
Logger.Error(11000, ex.ToString());
throw(ex);
}
}
Code: Select all