Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vacation.pl - replace_string() is produced parsing errors #818

Closed
ntavares opened this issue Apr 11, 2024 · 1 comment · Fixed by #819
Closed

vacation.pl - replace_string() is produced parsing errors #818

ntavares opened this issue Apr 11, 2024 · 1 comment · Fixed by #819

Comments

@ntavares
Copy link
Contributor

The replace_string introduced in commit be5dad4 contains an hardcoded strptime() format string to parse activefrom and activeuntil dates. However, I'm using Postgresql, and my schema is laid out as:

 activefrom    | timestamp with time zone | default '2000-01-01 00:00:00+01'::timestamp with time zone
 activeuntil   | timestamp with time zone | default '2000-01-01 00:00:00+01'::timestamp with time zone

Which means that the results of the query will be:

postfix=# SELECT activefrom,activeuntil FROM vacation WHERE email='....';
       activefrom       |      activeuntil       
------------------------+------------------------
 2024-04-10 11:14:00+02 | 2024-04-13 13:14:00+02
(1 row)

Therefore the script will produce complaints:

 (garbage at end of string in strptime:  00:00:00+02 at /usr/lib64/perl5/Time/Piece.pm line 481, <STDI)

According to perl_date_time.htm there's no way to catch the "+02" relative to the UTC offset.

Therefore I propose casting the field directly in the query, which solves the problem. I've validated the syntax with MySQL as well.

@DavidGoodwin
Copy link
Member

Thank you @ntavares

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants