Closed (duplicate)
Project:
Date
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Feb 2007 at 13:36 UTC
Updated:
7 Mar 2007 at 11:15 UTC
In my site I use Drupal 5.1 on PostgreSQL 7.4 I give some errors on page example.com/calendar (and something like this on others calendar pages):
* warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for integer: "2007-02-01" in /data/www/htdocs.users/staff/cit/jc01/includes/database.pgsql.inc on line 125.
* user warning: query: pager_query SELECT count(node.nid) FROM node node WHERE (node.status = '1') AND ((node.changed>='2007-02-01' AND node.changed<='2007-02-31')) in /data/www/htdocs.users/staff/cit/jc01/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for integer: "2007-02-01" in /data/www/htdocs.users/staff/cit/jc01/includes/database.pgsql.inc on line 125.
* user warning: query: pager_query SELECT node.nid, node.changed AS node_changed_changed, node.title AS node_title, node.changed AS node_changed, node.type FROM node node WHERE (node.status = '1') AND ((node.changed>='2007-02-01' AND node.changed<='2007-02-31')) ORDER BY node_changed_changed ASC LIMIT 99 OFFSET 0 in /data/www/htdocs.users/staff/cit/jc01/includes/database.pgsql.inc on line 144.
Question: realy MySQL support automatic conversion from 'yyyy-mm-dd' string into timestamp? :-O I have tried this query in my other site which is running on MySQL 4.1 and this type query run correct but count always 0 nodes...
Comments
Comment #1
karens commentedGet the latest development snapshot and try again. There have been fixes to the SQL handling.
Comment #2
havran commentedI still have no luck. :( I have tried calendar 5.x-1.x-dev and calendar HEAD, i tried reinstall views and i have still same problem - no timestamp in queries but 2007-02-28 like dates...
Comment #3
karens commentedPlease try again with latest development snapshot. This is not a POSTGRES issue, the sql is wrong and should be fixed in latest code. If it is still a problem in latest code, I need to see an export of your view.
Comment #4
havran commentedI have installed 5.x.1.x-dev now.
Here is my view:
Here is page with PostgreSQL errors: http://www.fem.uniag.sk/havran/testcalendar/2007/2
Thanks.
Comment #5
badrange commentedI have the same problem. Here is the view I have made. (hope I've installed the calendar in the correct way!)
$view = new stdClass();
$view->name = 'kalender';
$view->description = 'Calendar view of any date field';
$view->access = array ( );
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Kalender';
$view->page_header = 'Kalender';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = 'Ingenting å vise';
$view->page_empty_format = '1';
$view->page_type = 'calendar';
$view->url = 'kalender';
$view->use_pager = TRUE;
$view->nodes_per_page = '99';
$view->menu = TRUE;
$view->menu_title = '';
$view->menu_tab = TRUE;
$view->menu_tab_default = FALSE;
$view->menu_tab_weight = '0';
$view->block = TRUE;
$view->block_title = 'Kalender';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'calendar';
$view->nodes_per_block = '99';
$view->block_more = TRUE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array ( array ( 'tablename' => 'node', 'field' => 'changed', 'sortorder' => 'ASC', 'options' => 'normal', ), );
$view->argument = array ( array ( 'type' => 'calendar_year', 'argdefault' => '2', 'title' => 'Year', 'options' => '', 'wildcard' => '', 'wildcard_substitution' => '', ), array ( 'type' => 'calendar_month', 'argdefault' => '2', 'title' => 'Month', 'options' => '', 'wildcard' => '', 'wildcard_substitution' => '', ), array ( 'type' => 'calendar_day', 'argdefault' => '2', 'title' => 'Day', 'options' => '', 'wildcard' => '', 'wildcard_substitution' => '', ), array ( 'type' => 'calendar_week', 'argdefault' => '2', 'title' => 'Week', 'options' => '', 'wildcard' => '', 'wildcard_substitution' => '', ), );
$view->field = array ( array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title:', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated:', 'handler' => 'views_handler_field_date_small', ), );
$view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), );
$view->exposed_filter = array ( );
$view->requires = array(node);
$views[$view->name] = $view;
I just upgraded calendar and view to the latest version from CVS.
Hope you can help me, this calendar seems to work just the way I need it to!
Kind regards, Bernt
Comment #6
karens commentedPlease double check that you have the very latest code. The latest version of the code cannnot possibly produce SQL that looks like this. You also need the very latest code from the Date module since the SQL is configured in date.inc, so pick up the cvs version or latest nighly development snapshot for both.
Comment #7
havran commentedThanx for little guidance. I found some possible mistakes in date module > date.inc > date_sql() function. First there is no $db_type 'postgres' but 'pgsql'. Second for compatibility with PostgreSQL older than version 8 (7.4 is still in use) we need another approach into unix timestamp (in postgresql terminology 'epoch' or 'unixtime'). I now experimenting with code...
Some examples:
Comment #8
havran commentedI move this into http://drupal.org/node/125338... its date module related...
Comment #9
karens commentedMoving
Comment #10
karens commentedWe'll focus on the postgres fixes in http://drupal.org/node/125338, so marking this a duplicate.