View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0022463 | FPC | Database | public | 2012-07-18 18:48 | 2015-10-10 11:38 |
Reporter | Mark Morgan Lloyd | Assigned To | LacaK | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Fixed in Version | 3.0.0 | ||||
Summary | 0022463: IDE creates a spurious TQuery property when parsing complex SQL | ||||
Description | Attached project has a moderately complex query embedded in the TQuery object. On Lazarus trunk 36903 this works fine, but at some point after that the query parsing has changed so that it thinks it's seeing a spurious parameter called 00'::interval as well as the correct one (tz). In all cases with FPC 2.7.1, revision appears not to matter as long as the IDE etc. compiles. I've got this on SPARC (Solaris+Linux), PPC (Linux), x86 (Linux). Not tried ARM or Windows. Project doesn't need to be compiled to see the problem, only opened. | ||||
Additional Information | I've tried to simplify the SQL with limited success. At one point I thought I was able to demonstrate the problem with 0000004:0000004 lines of query, but when I restarted the IDE it had gone. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 31155 | ||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
2012-07-18 18:48
|
|
|
I've got this down to six lines of more-or-less-valid SQL: -----8<----- -- -- WATCH IT: any columns/fields of a type which aren't understood by SELECT coalesce( (SELECT utc_offset FROM pg_timezone_names WHERE name = :tz), '00:00'::interval ); ----->8----- Lazarus incorrectly parses a parameter 00'::interval out of that, instead of seeing tz. Removing the first comment line or changing the apostrophe in the second appears to fix it. This might not be the only issue, since removing the comment from the original query or moving it to the end still results in a spurious parameter (i.e. both 00'::interval and tz). |
|
What is stored in LineEnding ? (0000010?) I try it on Windows with small test program: with SQLQuery1 do begin Close; SQL.Text:='-----8<-----'+LineEnding+ '--'+LineEnding+ '-- WATCH IT: any columns/fields of a type which aren''t understood by'+LineEnding+ 'SELECT coalesce((SELECT utc_offset FROM pg_timezone_names WHERE name = :tz),'+LineEnding+ '''00:00''::interval);'+LineEnding+ '----->8-----'; end; but there is result correct = "tz" Parsing of SQL text is performed in dsparams.inc in Function TParams.ParseSQL, so you can look there to find problem. |
|
Those "snip" lines were my indication of the start and end of my example: I explicitly said that I'd got it down to SIX lines (but adding them here at design time doesn't change things). Try putting them in the SQL property of the TSQLQuery object (i.e. as in the example project I attached with the original report), this is a design-time issue. I'll try to look at that function later, thanks for the pointer. |
|
Please move to FPC project as is seems be problem with parameter parsing |
|
@Mark please retest and if error is still showed, then please let us know (but I was not able reproduce on Windows). Edit: I am able now reproduce with attached test22463.pas |
|
|
|
Fix confirmed for original app with Lazarus 1.4.2 and FPC 3.0 rc1. Apologies for the delay testing, but there were other issues in the same app (PostgreSQL LISTEN/NOTIFY). |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-07-18 18:48 | Mark Morgan Lloyd | New Issue | |
2012-07-18 18:48 | Mark Morgan Lloyd | File Added: bad_sql_params.tar.gz | |
2012-07-18 18:48 | Mark Morgan Lloyd | Widgetset | => GTK 2 |
2012-07-19 10:51 | Mark Morgan Lloyd | Note Added: 0061133 | |
2012-07-19 11:10 | Mark Morgan Lloyd | Note Edited: 0061133 | |
2012-07-19 11:22 | LacaK | Note Added: 0061135 | |
2012-07-19 12:14 | Mark Morgan Lloyd | Note Added: 0061137 | |
2015-06-25 10:47 | LacaK | Note Added: 0084707 | |
2015-06-25 14:04 | Maxim Ganetsky | Project | Lazarus => FPC |
2015-06-25 15:07 | LacaK | Note Added: 0084710 | |
2015-06-25 15:07 | LacaK | Assigned To | => LacaK |
2015-06-25 15:07 | LacaK | Status | new => feedback |
2015-06-26 10:04 | LacaK | File Added: test22463.pas | |
2015-06-26 10:05 | LacaK | Note Edited: 0084710 | View Revisions |
2015-06-26 10:07 | LacaK | Fixed in Revision | => 31155 |
2015-06-26 10:07 | LacaK | Status | feedback => resolved |
2015-06-26 10:07 | LacaK | Fixed in Version | => 3.1.1 |
2015-06-26 10:07 | LacaK | Resolution | open => fixed |
2015-08-30 22:44 | Joost van der Sluis | Fixed in Version | 3.1.1 => 3.0.1 |
2015-10-10 11:38 | Mark Morgan Lloyd | Note Added: 0086410 | |
2015-10-10 11:38 | Mark Morgan Lloyd | Status | resolved => closed |