many Postgres errors - default time of 0000-00-00 00:00:00 is illegal
tresero - April 24, 2009 - 03:33
| Project: | SEO Checklist |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Dave Reid |
| Status: | closed |
Description
I can test, and will look at this, but I want to report it.
Query failed: ERROR: date/time field value out of range: "0000-00-00 00:00:00" HINT: Perhaps you need a different "datestyle" setting. in /var/www/public_html/xxxxxxxx/drupal-6.10/includes/database.pgsql.inc on line 139
user warning: query: CREATE TABLE seo_checklist ( id serial, group_id smallint NOT NULL default 0, subgroup_id smallint NOT NULL default 0, name varchar(255) NOT NULL default '', module varchar(255) NOT NULL default '', option_checked smallint NOT NULL default 0, date_changed timestamp NOT NULL default '0000-00-00 00:00:00', linked_seo smallint NOT NULL default 0, checked_module smallint NOT NULL default 0, extra2 smallint NOT NULL default 0, extra3 smallint NOT NULL default 0, download varchar(255) NOT NULL default '', enable varchar(255) NOT NULL default '', configure varchar(255) NOT NULL default '', order_id smallint NOT NULL default 0, PRIMARY KEY (id) ) in /var/www/public_html/xxxxxxx/drupal-6.10/includes/database.inc on line 515.
warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "`" LINE 1: INSERT INTO seo_checklist (`id`, `group_id`, `subgroup_id`, ... ^ in /var/www/public_html/xxxxxxx/drupal-6.10/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO seo_checklist (`id`, `group_id`, `subgroup_id`, `name`, `module`, `download`, `enable`, `configure`, `order_id`) VALUES (1, 1, 0, 'Page Title Module', 'page_title', 'http://drupal.org/project/page_title', '/?q=admin/build/modules', '/?q=admin/content/page_title', 2), (2, 2, 0, 'Clean URLs - Activate (Usually automatic. Please <a href = ''/?q=admin/settings/clean-urls''>double-check</a>!)', '', '', '', '', 1), (5, 2, 0, 'Pathauto Module', 'pathauto', 'http://drupal.org/project/pathauto', '/?q=admin/build/modules', '/?q=admin/build/path/pathauto', 2), (6, 2, 0, 'Global Redirect Module', 'globalredirect', 'http://drupal.org/project/globalredirect', '/?q=admin/build/modules', '', 3), (7, 3, 0, 'Get a Google Account - You''ll need this for several of the steps that follow - <a href=''https://www.google.com/accounts/NewAccount''>https://www.google.com/accounts/NewAccount</a>', '', '', '', '', 1), (8, 3, 0, 'Get a Yahoo Account - You''ll need this for steps that follow - <a href=''http://www.yahoo.com/r/m7''>http://www.yahoo.com/r/m7</a>', '', '', '', '', 2), (44, 3, 0, 'Get a Live Account - You''ll need this for steps that follow - <a href=''https://accountservices.passport.net/reg.srf''>https://accountservices.passport.net/reg.srf</a>', '', '', '', '', 2), (9, 4, 0, 'Google Analytics Module', 'googleanalytics', 'http://drupal.org/project/google_analytics', '/?q=admin/build/modules', '/?q=admin/settings/googleanalytics', 1), (10, 4, 0, 'Sign in to your Google Analytics Account - <a href=''http://www.google.com/analytics''>http://www.google.com/analytics</a>', '', '', '', '', 2), (11, 4, 0, 'Create an Analytics for your website', '', '', '', '', 3), (12, 4, 0, 'Paste Google Analytics code into Google Analytics Module', '', '', '', '', 4), (13, 4, 0, 'Authenticate your site with Google Analytics', '', '', '', '', 5), (15, 5, 0, 'Meta Tags Module (AKA Nodewords)', 'nodewords', 'http://drupal.org/project/nodewords', '/?q=admin/build/modules', '/?q=admin/content/nodewords', 2), (16, 5, 0, 'Scheduler Module', 'scheduler', 'http://drupal.org/project/scheduler', '/?q=admin/build/modules', '/?q=admin/settings/scheduler', 3), (17, 5, 0, 'HTML Purifier Module', 'htmlpurifier', 'http://drupal.org/project/htmlpurifier', '/?q=admin/build/modules', '/?q=admin/settings/filters/1', 4), (45, 5, 0, '<a href=''/sites/all/modules/htmlpurifier/INSTALL.txt''>READ THE INSTALL INSTRUCTIONS!</a> then Download HTML Purifier. You will need 3.1.0rc1 or later. - <a href=''http://htmlpurifier.org/''>http://htmlpurifier.org/</a>', '', '', '', '', 5), (18, 5, 0, 'Search 404 Module', 'search404', 'http://drupal.org/project/search404', '/?q=admin/build/modules', '/?q=admin/settings/search404', 5), (19, 6, 0, 'Validate your site - <a href=''http://validator.w3.org/''>http://validator.w3.org/</a>', '', '', '', '', 1), (20, 6, 0, 'Check your links - <a href=''http://validator.w3.org/checklink''>http://validator.w3.org/checklink</a>', '', '', '', '', 2), (21, 7, 0, 'XML Sitemap Module', 'gsitemap', 'http://drupal.org/project/xmlsitemap', '/?q=admin/build/modules', '/?q=admin/settings/xmlsitemap', 1), (46, 7, 0, 'Site Map Module - a plain text sitemap', 'site_map', 'http://drupal.org/project/site_map', '/?q=admin/build/modules', '/?q=admin/settings/sitemap', 3), (22, 7, 0, 'Login to Google Webmaster Tools - <a href=''http://www.google.com/webmasters/tools''>http://www.google.com/webmasters/tools</a>', '', '', '', '', 5), (23, 7, 0, 'Authenticate your site with Google', '', '', '', '', 7), (24, 7, 0, 'Submit your XML Sitemap to Google - <a href=''http://www.google.com/webmasters/sitemaps/''>http://www.google.com/webmasters/sitemaps/</a>', '', '', '', '', 9), (25, 7, 0, 'Login to Yahoo Site Explorer Account - <a href=''https://siteexplorer.search.yahoo.com/''>https://siteexplorer.search.yahoo.com/</a>', '', '', '', '', 11), (26, 7, 0, 'Authenticate your site with Yahoo', '', '', '', '', 13), (27, 7, 0, 'Submit your XML Sitemap to Yahoo - <a href=''https://siteexplorer.search.yahoo.com/submit''>https://siteexplorer.search.yahoo.com/submit</a>', '', '', '', '', 15), (43, 7, 0, 'Authenticate your site with Live - <a href=''https://siteexplorer.search.yahoo.com/submit''>https://siteexplorer.search.yahoo.com/submit</a>', '', '', '', '', 17), (42, 7, 0, 'Login to Live', '', '', '', '', 19), (28, 7, 0, 'Submit your XML Sitemap to Live - <a href=''http://webmaster.live.com/webmaster/WebmasterAddSitesPage.aspx''>http://webmaster.live.com/webmaster/WebmasterAddSitesPage.aspx</a>', '', '', '', '', 21), (29, 7, 0, 'If appropriate, submit your company to Google Local - <a href=''https://www.google.com/webmasters/sitemaps/''>https://www.google.com/local/add/login</a>', '', '', '', '', 23), (30, 8, 0, 'Digg This Module', 'diggthis', 'http://drupal.org/project/diggthis', '/?q=admin/build/modules', '/?q=admin/settings/diggthis', 1), (31, 8, 0, 'Service Links Module', 'service_links', 'http://drupal.org/project/service_links', '/?q=admin/build/modules', '/?q=admin/settings/service_links', 2), (32, 8, 0, 'Trackback Module', 'trackback', 'http://drupal.org/project/trackback', '/?q=admin/build/modules', '/?q=admin/settings/trackback', 3), (33, 9, 2, 'Captcha Module', 'captcha', 'http://drupal.org/project/captcha', '/?q=admin/build/modules', '/?q=admin/user/captcha', 2), (34, 9, 2, 'Akismet Module', 'akismet', 'http://drupal.org/project/akismet', '/?q=admin/build/modules', '/?q=admin/settings/akismet', 3), (36, 9, 2, 'Spam Module', 'spam', 'http://drupal.org/project/spam', '/?q=admin/build/modules', '/?q=admin/settings/spam', 4), (38, 2, 0, 'Path Redirect Module', 'path_redirect', 'http://drupal.org/project/path_redirect', '/?q=admin/build/modules', '', 4), (39, 9, 1, 'HIGHLY RECOMMENDED: Mollom Module', 'Mollom', 'http://drupal.org/project/mollom', '/?q=admin/build/modules', '/?q=admin/settings/mollom', 1), (41, 1, 0, 'Token (required for other modules to function)', 'Token', 'http://drupal.org/project/token', '/?q=admin/build/modules', '', 1), (40, 9, 1, 'HIGHLY RECOMMENDED: Sign up for Mollom\'s free service and get Mollom code - <a href=''http://mollom.com/user/register''> http://mollom.com/user/register</a>', '', '', '', '', 0 ) in /var/www/public_html/xxxxxxx/drupal-6.10/sites/all/modules/seo_checklist/SEOChecklist.install on line 164.
#1
There is no create table, so this will never work. can you send me what you think it should do and I will add it and send a patch
#2
OK, Sorry, it was late last night.
For postgres there is no default time of 0000-00-00 00:00:00
That is very mysql, maybe you can just use null if that is what you want or now()
#3
Try 2.0. Download it here: Drupal SEO Checklist
#4
Your create table statement still uses the default time of default time of 0000-00-00 00:00:00 which is illegal under postgres and should be illegal under all databases since it is an intentional corruption of the database. A month value or day of month value of zero is invalid data (there is no such thing as month zero or day zero). The correct way to flag any value as uninitialized in SQL is to use and test for NULL.
#5
If you will post a patch, I'd be happy to test it. I'm not sure I follow what's going wrong as I don't use postgres. If we make that change, will it still work with mysql?
#6
I added now to the default creation. Now the following error is returned when installing the module.
I use Postrges as my back end. What can I do to get your module to work?
Thanks
warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "`" LINE 1: INSERT INTO seo_checklist (`id`, `group_id`, `subgroup_id`, ... ^ in /Library/WebServer/www.solarbee.com/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO seo_checklist (`id`, `group_id`, `subgroup_id`, `name`, `module`, `download`, `enable`, `configure`, `order_id`) VALUES (1, 1, 0, 'Page Title Module', 'page_title', 'http://drupal.org/project/page_title', 'admin/build/modules', 'admin/content/page_title', 2), (2, 2, 0, 'Clean URLs - Activate (Usually automatic. Please double-check!)', '', '', '', '', 1), (5, 2, 0, 'Pathauto Module', 'pathauto', 'http://drupal.org/project/pathauto', 'admin/build/modules', 'admin/build/path/pathauto', 2), (6, 2, 0, 'Global Redirect Module', 'globalredirect', 'http://drupal.org/project/globalredirect', 'admin/build/modules', '', 3), (7, 3, 0, 'Get a Google Account - You''ll need this for several of the steps that follow - https://www.google.com/accounts/NewAccount', '', '', '', '', 1), (8, 3, 0, 'Get a Yahoo Account - You''ll need this for steps that follow - http://www.yahoo.com/r/m7', '', '', '', '', 2), (44, 3, 0, 'Get a Live Account - You''ll need this for steps that follow - https://accountservices.passport.net/reg.srf', '', '', '', '', 2), (9, 4, 0, 'Google Analytics Module', 'googleanalytics', 'http://drupal.org/project/google_analytics', 'admin/build/modules', 'admin/settings/googleanalytics', 1), (10, 4, 0, 'Sign in to your Google Analytics Account - http://www.google.com/analytics', '', '', '', '', 2), (11, 4, 0, 'Create an Analytics for your website', '', '', '', '', 3), (12, 4, 0, 'Paste Google Analytics code into Google Analytics Module', '', '', '', '', 4), (13, 4, 0, 'Authenticate your site with Google Analytics', '', '', '', '', 5), (15, 5, 0, 'Meta Tags Module (AKA Nodewords)', 'nodewords', 'http://drupal.org/project/nodewords', 'admin/build/modules', 'admin/content/nodewords', 2), (16, 5, 0, 'Scheduler Module', 'scheduler', 'http://drupal.org/project/scheduler', 'admin/build/modules', 'admin/settings/scheduler', 3), (17, 5, 0, 'HTML Purifier Module', 'htmlpurifier', 'http://drupal.org/project/htmlpurifier', 'admin/build/modules', 'admin/settings/filters/1', 4), (45, 5, 0, 'READ THE INSTALL INSTRUCTIONS! then Download HTML Purifier. You will need 3.1.0rc1 or later. - http://htmlpurifier.org/', '', '', '', '', 5), (18, 5, 0, 'Search 404 Module', 'search404', 'http://drupal.org/project/search404', 'admin/build/modules', 'admin/settings/search404', 5), (19, 6, 0, 'Validate your site - http://validator.w3.org/', '', '', '', '', 1), (20, 6, 0, 'Check your links - http://validator.w3.org/checklink', '', '', '', '', 2), (21, 7, 0, 'XML Sitemap Module', 'gsitemap', 'http://drupal.org/project/xmlsitemap', 'admin/build/modules', 'admin/settings/xmlsitemap', 1), (46, 7, 0, 'Site Map Module - a plain text sitemap', 'site_map', 'http://drupal.org/project/site_map', 'admin/build/modules', 'admin/settings/sitemap', 3), (22, 7, 0, 'Login to Google Webmaster Tools - http://www.google.com/webmasters/tools', '', '', '', '', 5), (23, 7, 0, 'Authenticate your site with Google', '', '', '', '', 7), (24, 7, 0, 'Submit your XML Sitemap to Google - http://www.google.com/webmasters/sitemaps/', '', '', '', '', 9), (25, 7, 0, 'Login to Yahoo Site Explorer Account - https://siteexplorer.search.yahoo.com/', '', '', '', '', 11), (26, 7, 0, 'Authenticate your site with Yahoo', '', '', '', '', 13), (27, 7, 0, 'Submit your XML Sitemap to Yahoo - https://siteexplorer.search.yahoo.com/submit', '', '', '', '', 15), (43, 7, 0, 'Authenticate your site with Live - https://siteexplorer.search.yahoo.com/submit', '', '', '', '', 17), (42, 7, 0, 'Login to Live', '', '', '', '', 19), (28, 7, 0, 'Submit your XML Sitemap to Live - http://webmaster.live.com/webmaster/WebmasterAddSitesPage.aspx', '', '', '', '', 21), (29, 7, 0, 'If appropriate, submit your company to Google Local - https://www.google.com/local/add/login', '', '', '', '', 23), (30, 8, 0, 'Digg This Module', 'diggthis', 'http://drupal.org/project/diggthis', 'admin/build/modules', 'admin/settings/diggthis', 1), (31, 8, 0, 'Service Links Module', 'service_links', 'http://drupal.org/project/service_links', 'admin/build/modules', 'admin/settings/service_links', 2), (32, 8, 0, 'Trackback Module', 'trackback', 'http://drupal.org/project/trackback', 'admin/build/modules', 'admin/settings/trackback', 3), (33, 9, 2, 'Captcha Module', 'captcha', 'http://drupal.org/project/captcha', 'admin/build/modules', 'admin/user/captcha', 2), (34, 9, 2, 'Akismet Module', 'akismet', 'http://drupal.org/project/akismet', 'admin/build/modules', 'admin/settings/akismet', 3), (36, 9, 2, 'Spam Module', 'spam', 'http://drupal.org/project/spam', 'admin/build/modules', 'admin/settings/spam', 4), (38, 2, 0, 'Path Redirect Module', 'path_redirect', 'http://drupal.org/project/path_redirect', 'admin/build/modules', '', 4), (39, 9, 1, 'HIGHLY RECOMMENDED: Mollom Module', 'Mollom', 'http://drupal.org/project/mollom', 'admin/build/modules', 'admin/settings/mollom', 1), (41, 1, 0, 'Token (required for other modules to function)', 'Token', 'http://drupal.org/project/token', 'admin/build/modules', '', 1), (40, 9, 1, 'HIGHLY RECOMMENDED: Sign up for Mollom\'s free service and get Mollom code - http://mollom.com/user/register', '', '', '', '', 0 ) in /Library/WebServer/www.solarbee.com/sites/all/modules/seo_checklist/seochecklist.install on line 244.
#7
As well as the default time problem, this code uses multi-row inserts, which are only supported in Postgres 8.2+. For those of us running nice stable Debian servers with Postgres 8.1, the multi-row inserts need to be split into individual statements.
#8
Actually what should be used here is a simple integer column which store the UNIX timestamp of the event. We can then use format_date to make it look pretty. There are a lot more problems trying to use direct datetime data types, but at least they're supported in D7. But it's a lot easier to use UNIX timestamps. I can provide a patch in the next couple of days.
#9
And just to add another problem, the INSERT INTO {seo_checklist} column names are surrounded by `back-ticks`. Are these legal in mySQL, because they certainly aren't in Postgres?
The attached .install file seems to at least install without errors on Postgres 8.1 (drop the .txt extension). I've yet to test whether the module behaves sensibly and it hasn't been tested on mySQL.
#10
Step 1 of converting that field to an integer field for UNIX timestamp committed to CVS. Working on step 2 and separating all the insert queries and removing backticks and then testing on PgSQL.
#11
With the latest code in CVS, I can now say the module fully works with PostgreSQL. Thanks for the help everyone!
#12
Automatically closed -- issue fixed for 2 weeks with no activity.