Please correct me if I am misinterpreting this.

In the rdf.db.inc file, you have the following lines:

$result = db_query('SELECT DISTINCT g.uri g FROM {' . db_escape_table($table) . '} d INNER JOIN {rdf_resources} g ON d.gid = g.rid');

and

$sql = 'SELECT g.uri g, s.uri s, p.uri p, o.uri o, t.uri type, d.lang, d.data FROM {%s} d

For the first line, shouldn't g.uri g be g.uri AS g ??

and for the second line, shouldn't g.uri g, s.uri s, p.uri p, o.uri o, t.uri type be g.uri AS g, s.uri AS s, p.uri AS p, o.uri AS o, t.uri AS type

I believe not all sql languages assume the AS keyword.

Comments

scor’s picture

That's right. For instance PostgreSQL requires AS when specifying alias names for output columns.

crisuskeer’s picture

I use a PostgreSQL database, and this had been bothering me for a long while until I finally discovered this thread.

"type" is a reserved word in PostgreSQL so having a column named simply "type" in the "drupal_rdf_repositories" table would appear to be riskier than it ought to be.

The PHP warnings I would get look like:

warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "type" LINE 1: SELECT g.uri g, s.uri s, p.uri p, o.uri o, t.uri type, d.lan..
in C:\...\drupal\includes\database.pgsql.inc on line 139.

I thank scor for pointing out the easy fix by adding the 'AS' keyword.

smustgrave’s picture

Issue summary: View changes
Status: Active » Closed (outdated)