PostgreSQL 9.1 on Debian Wheezy and Drupal 7.22.

Steps to reproduce:

  1. Install Drupal and pathauto. Enable the blog module.
  2. Configure the URL pattern for the blog content type to be blog/[node:title]
  3. Create a new blog post with all default values and save it

This will result in a fatal error preventing the node from being saved. In watchdog this can be seen:

PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: INSERT INTO url_alias (source, alias, language) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( ) in drupal_write_record() (line 7136 of .../includes/common.inc).

This can be seen in the PostgreSQL log:

2013-06-08 15:14:41 CEST ERROR:  invalid input syntax for integer: "test-title" at character 422
2013-06-08 15:14:41 CEST STATEMENT:  SELECT base.uid AS uid, base.name AS name, base.pass AS pass, base.mail AS mail, base.theme AS theme, base.signature AS signature, base.signature_format AS signature_format, base.created AS created, base.access AS access, base.login AS login, base.status AS status, base.timezone AS timezone, base.language AS language, base.picture AS picture, base.init AS init, base.data AS data
	FROM 
	users base
	WHERE  (base.uid IN  ('test')) -- The generated url
2013-06-08 15:14:41 CEST ERROR:  current transaction is aborted, commands ignored until end of transaction block
2013-06-08 15:14:41 CEST STATEMENT:  INSERT INTO url_alias (source, alias, language) VALUES ('node/67', 'blog/test-title', 'und')

This is the stack trace of the error:

#0 /includes/database/database.inc(2168): PDOStatement->execute(NULL)
#1 /includes/database/pgsql/database.inc(106): DatabaseStatementBase->execute(NULL, Array)
#2 /includes/database/pgsql/query.inc(96): DatabaseConnection_pgsql->query(Object(DatabaseStatementBase), Array, Array)
#3 /includes/common.inc(7136): InsertQuery_pgsql->execute()
#4 /includes/path.inc(442): drupal_write_record('url_alias', Array)
#5 /sites/all/modules/pathauto/pathauto.inc(550): path_save(Array)
#6 /sites/all/modules/pathauto/pathauto.inc(428): _pathauto_set_alias(Array, Array, 'update')
#7 /sites/all/modules/pathauto/pathauto.module(576): pathauto_create_alias('node', 'update', 'node/67', Array, 'blog', 'und')
#8 /sites/all/modules/pathauto/pathauto.module(518): pathauto_node_update_alias(Object(stdClass), 'update')
#9 [internal function]: pathauto_node_update(Object(stdClass))
#10 /includes/module.inc(857): call_user_func_array('pathauto_node_u...', Array)
#11 /modules/node/node.module(1185): module_invoke_all('node_update', Object(stdClass))
#12 /modules/node/node.pages.inc(457): node_save(Object(stdClass))
#13 /includes/form.inc(1464): node_form_submit(Array, Array)
#14 /includes/form.inc(860): form_execute_handlers('submit', Array, Array)
#15 /includes/form.inc(374): drupal_process_form('blog_node_form', Array, Array)
#16 /includes/form.inc(131): drupal_build_form('blog_node_form', Array)
#17 /modules/node/node.pages.inc(14): drupal_get_form('blog_node_form', Object(stdClass))
#18 [internal function]: node_page_edit(Object(stdClass))
#19 /includes/menu.inc(517): call_user_func_array('node_page_edit', Array)
#20 /index.php(21): menu_execute_active_handler()
#21 {main}

It's easiest to reproduce this with the URL pattern above. Sometimes it might fail with a different pattern such as acbd/[node:title] but this needs to be further verified. The content type using the pattern doesn't really matter.

dhbenjy on IRC:

Line 442 of path.inc try's to save the url_alias without the ['original'] key set. Not sure if that's the issue but it seems to flow through to the error. I'd raise an issue in the path auto issue queue however the problem may stem from elsewhere.

Possible related issues: