[Maia-users] invalid input syntax for type timestamp: "4Y-2m-2d 2H:2M:2S"

Marc G. Fournier scrappy at hub.org
Mon Apr 16 22:38:09 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Found it in my old emails and yes, it fixes it ...

But, that re-brings up the point ... what man page are you looking at that:

strftime("%04Y-%02m-%02d %02H:%02M:%02S",localtime);

is actually valid?  I just checked my FreeBSD man page for strftime, and it 
states:

"A conversion specification consists of a percent sign ```%''' and one other 
character."

Not 'several other' ... according to FreeBSD, your above translates as:

%0 %0 %0 %0:%0:%0

wiht the 4Y- 2m- 2d not being processed, or, rather, being seen as 'text' ...

The 'spacing' values are redundant, at least they should be ... %Y should 
*always* be 4 digits ... while %m should always be two:

%m    is replaced by the month as a decimal number (01-12).

Its not 1-12, its 01-12 ... same with %H:


     %H    is replaced by the hour (24-hour clock) as a decimal number
           (00-23).

If you wanted 0-23, you would use %k instead:

     %k    is replaced by the hour (24-hour clock) as a decimal number (0-23);
           single digits are preceded by a blank.

Now, I just found a Linux man page for strftime, and it looks to me like what 
you are doing above will, in fact, break on every system *except* for a Linux 
system (re GLIBC Notes):

"Glibc provides some extensions for conversion specifications. (These 
extensions are not specified in POSIX.1-2001, but a few other systems provide 
similar features.) Between the % character and the conversion specifier 
character, an optional flag and field width may be specified."

But, those are Linux-isms, and break portability ... this appears to be an OS 
issue, not a PostgreSQL vs MySQL issue ...


- --On Monday, April 16, 2007 20:12:44 -0700 Robert LeBlanc <rjl at renaissoft.com> 
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Marc G. Fournier wrote:
>>
>>
>> Diagnostic-Code: X-Postfix; host maia.hub.org[200.46.204.183] said: 451 4.5.0
>>     Error in processing, id=80912-01, cached FAILED: DBD::Pg::st execute
>>     failed: ERROR:  invalid input syntax for type timestamp: "4Y-2m-2d
>>     2H:2M:2S" (in reply to end of DATA command)
>>
>> I haven't traced the problem yet .. if someone has a ready fixed, that would
>> be  great ...
>
> What version of Maia are you using?  You raised an issue very similar to
> this last September:
>
> <http://www.renaissoft.com/pipermail/maia-users/2006-September/007459.html>
>
> Try the trick that worked for you in that thread, and let us know
> whether it solves the problem for you; if so, we can open a ticket and
> get that small fix into the repository (it probably got overlooked until
> now because there was no ticket associated with it).
>
> - --
> Robert LeBlanc <rjl at renaissoft.com>
> Renaissoft, Inc.
> Maia Mailguard <http://www.maiamailguard.com/>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFGJDsrGmqOER2NHewRAjS7AKCVAiO8zQ20UNZv1TlQBgnH3jCtkgCfTp8d
> ShICWIQSHY7A027BEygcFaQ=
> =HMu2
> -----END PGP SIGNATURE-----
> _______________________________________________
> Maia-users mailing list
> Maia-users at renaissoft.com
> http://www.renaissoft.com/mailman/listinfo/maia-users



- ----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email . scrappy at hub.org                              MSN . scrappy at hub.org
Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFGJF1B4QvfyHIvDvMRAgE5AJ9zj6Cx65tMa2lxJwDUeHolrWBaAACgqjmw
2At5dCMbiPwHKz33ifJt6ZE=
=mCkk
-----END PGP SIGNATURE-----



More information about the Maia-users mailing list