Hello !

Thanks you for this uselful module.

I am using PostgreSQL 8.

Under Views 3.3, if i try to use the countdown field, i obtain this message:

SQLSTATE[42883]: Undefined function: 7 ERROR: function unix_timestamp() does not exist LINE 1: ...e_entity_type, IF(unpublish_on AND unpublish_on > UNIX_TIMES... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.

I am not sure if PostgreSQL is the problem.


Title:PostgreSQL - Countdown field views ErrorPostgreSQL - Countdown field error - unix_timestamp() does not exist
Status:Active» Closed (cannot reproduce)

Hi Jibus,

Is this still a problem for you? I've not had any experience with PostgreSQL databases, but it seems you are saying that the function unix_timestamp() is not implemented. I guess there must be an alternative, but this would usually be handled in Drupal's database abstraction layer.

If you are still getting this error, please re-open the issue and let us know what Drupal version you are running and what PostgreSQL version you have.


Status:Closed (cannot reproduce)» Active

Just searched Drupal.org and this has been reported before:
#690322: Postgresql error: Function unix_timestamp() does not exist
#1538782: MySQL-specific unix_timestamp() is used in og_mailinglist.install

Seems that unix_timestamp() is a MySQL-specific function, and that PHP's time() is the preferred alternative which does the same thing. However, the actual line in scheduler_handler_field_scheduler_countdown.inc is within the query() function of the scheduler_handler_field_scheduler_countdown class.

->field_alias = $this->query->add_field(NULL, 'IF(' . $time_field . ' AND ' . $time_field . ' > UNIX_TIMESTAMP(), ' . $time_field . ' - UNIX_TIMESTAMP(), NULL)', $this->table_alias . '_' . $this->field);

Not sure how the php function would work here because it needs to be executed at run-time.