Bug: Incorrect fsdir result

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: Incorrect fsdir result

Jake
The following returns an erroneous fsdir error. Tested on macOS 10.13.6.

SQLite version 3.25.3 2018-11-05 20:37:38
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE d AS SELECT '.' d;
sqlite> CREATE TABLE x AS SELECT 1 x;
sqlite> SELECT name
   ...>   FROM d
   ...>   JOIN x
   ...>   JOIN fsdir(d)
   ...>  ORDER BY 1;
Error: table function fsdir requires an argument
sqlite>


These variants all run as expected:

SELECT name
  FROM d
  JOIN x
  JOIN fsdir('.')
 ORDER BY 1;

SELECT name
  FROM (SELECT '.' d)
  JOIN (SELECT 1 x)
  JOIN fsdir(d)
 ORDER BY 1;

SELECT name
  FROM d
  JOIN x
  JOIN fsdir(d);

SELECT name
  FROM d
  JOIN fsdir(d)
 ORDER BY 1;

Regards

Jake
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Incorrect fsdir result

Richard Hipp-3
On 11/15/18, Jake Thaw <[hidden email]> wrote:
> The following returns an erroneous fsdir error. Tested on macOS 10.13.6.
>
> SQLite version 3.25.3 2018-11-05 20:37:38
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> CREATE TABLE d AS SELECT '.' d;
> sqlite> CREATE TABLE x AS SELECT 1 x;

It works if you add "ANALYZE;" here, so that the query planner knows
that both d and x are one-row tables.

> sqlite> SELECT name
>    ...>   FROM d
>    ...>   JOIN x
>    ...>   JOIN fsdir(d)
>    ...>  ORDER BY 1;
> Error: table function fsdir requires an argument
> sqlite>
>
>
> These variants all run as expected:
>
> SELECT name
>   FROM d
>   JOIN x
>   JOIN fsdir('.')
>  ORDER BY 1;
>
> SELECT name
>   FROM (SELECT '.' d)
>   JOIN (SELECT 1 x)
>   JOIN fsdir(d)
>  ORDER BY 1;
>
> SELECT name
>   FROM d
>   JOIN x
>   JOIN fsdir(d);
>
> SELECT name
>   FROM d
>   JOIN fsdir(d)
>  ORDER BY 1;
>
> Regards
>
> Jake
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users