Last modified: 2014-11-19 12:00:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T36855, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34855 - Query failed: ERROR: syntax error at or near "smw_tmp_unusedprops" LINE 1: ...iesSpecial Mioze7Ae */ OR REPLACE FUNCTION create_"smw_tmp_u... ^
Query failed: ERROR: syntax error at or near "smw_tmp_unusedprops" LINE 1: ....
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-01 16:19 UTC by Anton Kochkov
Modified: 2014-11-19 12:00 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Fix up the table name. (1.55 KB, patch)
2012-03-05 22:03 UTC, Andrew Ruthven
Details

Description Anton Kochkov 2012-03-01 16:19:40 UTC
Error on Special:CreateTemplate page

Warning:  pg_query() function.pg-query: Query failed: ERROR:  syntax error at or near "smw_tmp_unusedprops"
LINE 1: ...iesSpecial Mioze7Ae */ OR REPLACE FUNCTION create_"smw_tmp_u...
                                                             ^ in /www/includes/db/DatabasePostgres.php on line 254


Version of MediaWiki: 1.19alpha
SemanticMediaWiki: Version 1.7.1 alpha3

http://droid-developers.org/wiki/Special:Version
Comment 1 Andrew Ruthven 2012-03-05 22:03:28 UTC
Created attachment 10179 [details]
Fix up the table name.
Comment 2 Andrew Ruthven 2012-03-05 22:04:28 UTC
The Postgres logs have:

ser=wikiuser,db=wikidb ERROR:  syntax error at or near ""smw_tmp_unusedprops"" at character 89
ser=wikiuser,db=wikidb STATEMENT:  CREATE /* SMWSQLStore2::getUnusedPropertiesSpecial Andrew */ OR REPLACE FUNCTION create_"smw_tmp_unusedprops"() RETURNS void AS $$ BEGIN  IF EXISTS(SELECT NULL FROM pg_tables WHERE tablename='"smw_tmp_unusedprops"' AND schemaname = ANY (current_schemas(true)))  THEN DELETE FROM "smw_tmp_unusedprops";  ELSE   CREATE TEMPORARY TABLE "smw_tmp_unusedprops" ( title text );  END IF; END; $$ LANGUAGE 'plpgsql'; SELECT create_"smw_tmp_unusedprops"(); 

The patch I've attached resolves this issue.
Comment 3 Sumana Harihareswara 2012-03-06 01:34:41 UTC
Adding keywords to signal that this patch awaits review.  Thank you for the patch, Andrew.
Comment 4 Anton Kochkov 2012-03-06 13:53:41 UTC
After applied patch i can see:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input LINE 1: ...N "smw_ids" ON p_id=smw_id AND title=smw_title AND smw_iw='' ^ in /home/droid-dev/www/includes/db/DatabasePostgres.php on line 254

Warning: pg_query() [function.pg-query]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /home/droid-dev/www/includes/db/DatabasePostgres.php on line 254
Comment 5 Anton Kochkov 2012-03-06 13:54:05 UTC
forgot this line too:

Warning: Invalid argument supplied for foreach() in /home/droid-dev/www/includes/resourceloader/ResourceLoaderWikiModule.php on line 201
Comment 6 Sumana Harihareswara 2012-03-06 14:35:17 UTC
Marking patch as reviewed.
Comment 7 Jeroen De Dauw 2012-03-06 16:12:44 UTC
(In reply to comment #6)
> Marking patch as reviewed.

Wrong bug/patch??
Comment 8 Jeroen De Dauw 2012-03-06 16:23:05 UTC
(In reply to comment #2)
> The patch I've attached resolves this issue.

Thanks for the patch. I have some concerns with it though, and only applied a part of it in r113147. Can you tell me if this fixes the issue?
Comment 9 Anton Kochkov 2012-03-06 16:53:22 UTC
(In reply to comment #8)
> (In reply to comment #2)
> > The patch I've attached resolves this issue.
> 
> Thanks for the patch. I have some concerns with it though, and only applied a
> part of it in r113147. Can you tell me if this fixes the issue?

See comment #4 - patch applied solves issue only partially - i have now another error.
Comment 10 Jeroen De Dauw 2012-03-06 17:01:11 UTC
Ok, so the original issue has been fixed - great.

I don't know how to fix the error reported in comment #4, it does not give me enough info.
Comment 11 Andrew Ruthven 2012-03-06 21:12:40 UTC
The error in comment #4 was fixed in r111256.

Jeroen, did you test r113147 against PostgreSQL?  It doesn't work for me.  The error from Pg is:

user=wikiuser,db=wikidb ERROR:  column "smw_tmp_unusedprops" does not exist at character 59
user=wikiuser,db=wikidb QUERY:  SELECT  EXISTS(SELECT NULL FROM pg_tables WHERE tablename="smw_tmp_unusedprops" AND schemaname = ANY (current_schemas(true)))


user=wikiuser,db=wikidb CONTEXT:  PL/pgSQL function "create_smw_tmp_unusedprops" line 1 at IF
user=wikiuser,db=wikidb STATEMENT:  CREATE /* SMWSQLStore2::getUnusedPropertiesSpecial Andrew */ OR REPLACE FUNCTION create_smw_tmp_unusedprops() RETURNS void AS $$ BEGIN  IF EXISTS(SELECT NULL FROM pg_tables WHERE tablename="smw_tmp_unusedprops" AND schemaname = ANY (current_schemas(true)))  THEN DELETE FROM "smw_tmp_unusedprops";  ELSE   CREATE TEMPORARY TABLE "smw_tmp_unusedprops" ( title text );  END IF; END; $$ LANGUAGE 'plpgsql'; SELECT create_smw_tmp_unusedprops(); 

This is because single quotes and double quotes have different meanings in PostgreSQL. In this case smw_tmp_unusedprops needs to have single quotes around it to refer to be treated as a string, double quotes means it is a column. The patch as I supplied does the right thing "TM". :)

I'd suggest that the error in comment #5 is an unrelated error.
Comment 12 Greg Sabino Mullane 2012-04-06 14:03:57 UTC
I committed r114764 which should fix the error above. I will fix other bugs as I run into them, as I've just started using SMW.

P.S. Any plans to move SMW* to git, or should I assume svn access for a while?
Comment 13 Markus Krötzsch 2012-04-06 14:58:16 UTC
(In reply to comment #12)
...
> 
> P.S. Any plans to move SMW* to git, or should I assume svn access for a while?

SMW and most extensions should be in git *very* soon (maybe they already are while I am writing this).
Comment 14 Brandon Plewe 2012-08-23 04:29:06 UTC
This is an incomplete patch, because the same error also occurs in getCreateTempIDTableSQL() which has the same PostgreSQL temporary table workaround. The problem is the quotes, as added in the Database tableName function (this is new in MW 1.19). Since I assume the quotes were added for a good reason (but in keeping with SQL standard, shouldn't they be single quotes?), I just took them back out at the beginning of the getCreateTempIDTableSQL() function:

$tablename = str_replace(array('"',"'"),"",$tablename);

I know that's a clumsy fix, but it got my hierarchical query working. Hope someone can find a more elegant solution.
Comment 15 Jeroen De Dauw 2013-01-08 00:27:00 UTC
We are now using Git.

https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticMediaWiki.git

https://www.mediawiki.org/wiki/Git

A patch on gerrit against master is more then welcome :)
Comment 16 MWJames 2014-11-19 12:00:24 UTC
Expected to be solved by [0].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/638

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links