{"action":"opened","issue":{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/214","repository_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser","labels_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/214/comments","events_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/214/events","html_url":"https://github.com/greenlion/PHP-SQL-Parser/issues/214","id":182661934,"number":214,"title":"USING (identifier) translates to USING () ","user":{"login":"mf2q","id":19696931,"avatar_url":"https://avatars.githubusercontent.com/u/19696931?v=3","gravatar_id":"","url":"https://api.github.com/users/mf2q","html_url":"https://github.com/mf2q","followers_url":"https://api.github.com/users/mf2q/followers","following_url":"https://api.github.com/users/mf2q/following{/other_user}","gists_url":"https://api.github.com/users/mf2q/gists{/gist_id}","starred_url":"https://api.github.com/users/mf2q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mf2q/subscriptions","organizations_url":"https://api.github.com/users/mf2q/orgs","repos_url":"https://api.github.com/users/mf2q/repos","events_url":"https://api.github.com/users/mf2q/events{/privacy}","received_events_url":"https://api.github.com/users/mf2q/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-12T23:49:03Z","updated_at":"2016-10-12T23:49:03Z","closed_at":null,"body":"I'm working on a plugin for Wordpress to allow using PostgreSQL for a backend, and PHP-SQL-Parser simplifies so much ... but, just hit a case where part of the query is being removed:\r\n\r\nOriginal Query:\r\n`SELECT wp_term_taxonomy.term_taxonomy_id FROM wp_term_taxonomy INNER JOIN wp_terms USING (term_id) WHERE taxonomy = 'post_tag' AND wp_terms.slug IN ('barman')\r\n`\r\nAfter going through Parser -> Creator:\r\n`SELECT wp_term_taxonomy.\"term_taxonomy_id\" FROM wp_term_taxonomy INNER JOIN wp_terms USING (\"\") WHERE \"taxonomy\" = 'post_tag' AND wp_terms.\"slug\" IN ('barman')\r\n`\r\n\r\nNow, the quotes around the identifies is code I wrote to put double quotes around all identifiers, since, unlike MySQL, PostgreSQL is case insensitive on identifiers ... without that code active, converting the original query results in:\r\n\r\n`PHP Fatal error:  Uncaught exception 'PHPSQLParser\\\\exceptions\\\\UnableToCreateSQLException' with message 'unknown [expr_type] = colref in \"CREATE TABLE column-list subtree\" [0] ' in /usr/local/www/d_admin/blog.2ndquadrant.com/www/wp-content/pg4wp/PHP-SQL-Parser/src/PHPSQLParser/builders/ColumnListBuilder.php:77\\nStack trace:\r\n#0 /usr/local/www/d_admin/blog.2ndquadrant.com/www/wp-content/pg4wp/PHP-SQL-Parser/src/PHPSQLParser/builders/RefClauseBuilder.php(87): PHPSQLParser\\\\builders\\\\ColumnListBuilder->build(Array, ',')\r\n#1 /usr/local/www/d_admin/blog.2ndquadrant.com/www/wp-content/pg4wp/PHP-SQL-Parser/src/PHPSQLParser/builders/RefClauseBuilder.php(103): PHPSQLParser\\\\builders\\\\RefClauseBuilder->buildColumnList(Array)\r\n#2 /usr/local/www/d_admin/blog.2ndquadrant.com/www/wp-content/pg4wp/PHP-SQL-Parser/src/PHPSQLParser/builders/TableBuilder.php(77): PHPSQLParser\\\\builders\\\\RefClauseBuilder->build(Array)\r\n#3 /usr/local/www/d_admin/blog.2ndquadrant.com/www/wp-content/pg4wp/PHP-SQL-Parser/src/PHPSQLParser/builde...\\n', referer: http://blog.2ndquadrant.com/`\r\n\r\nSo it looks like the identifier is being stripped out ... is hte original wordpress code wrong / bad, or is this just a condition that hasn't been properly caught by the Parser?\r\n\r\nThanks ..."}}
{"actor":{"display_login":"mf2q"}}