Project

General

Profile

Bug #5658

Wt::Dbo - selecting fields with "from" in the name causes the SELECT statement to be misparsed

Added by Roy Wiggins over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/17/2017
Due date:
% Done:

0%

Estimated time:

Description

Postgres supports fields that include reserved words, like 'from':

SELECT from_field,to_field FROM test_table

However, queries like this result in a "not enough aliases for results" error in Wt::Dbo, as in:

session.query<boost::tuple<std::string,std::string>>("SELECT from_field,to_field FROM test_table")

Renaming the field fixes the problem. Also, just requesting that field by itself is fine (the following works):

session.query<boost::tuple<std::string>>("SELECT from_field FROM test_table")

I'm not sure what's happening here, but I assume the SQL parser is sometimes terminating the SELECT clause as soon as it sees the first "from", without looking ahead to see if it's followed by a space or not.

#1

Updated by Michiel Derhaeg over 4 years ago

  • Status changed from New to Implemented @Emweb
#2

Updated by Roel Standaert over 4 years ago

  • Status changed from Implemented @Emweb to Resolved
#3

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF