pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15606: Postgres incorrectly returns syntax error when using WITH clacuse
2+ messages / 2 participants
[nested] [flat]

* BUG #15606: Postgres incorrectly returns syntax error when using WITH clacuse
@ 2019-01-23 13:18  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2019-01-23 13:18 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: newsx@outlook.com

The following bug has been logged on the website:

Bug reference:      15606
Logged by:          Rikke Hammer
Email address:      newsx@outlook.com
PostgreSQL version: 11.1
Operating system:   Windows 10 Home  version1803 x64
Description:        

I get a syntax error when I try to use a WITH clause in a query. Below is a
simple test query. It (as as well as any other WITH clause query I do,
creates the following error:

          SQL Error [42601]: ERROR: syntax error at end of input
          Position: 53
           ERROR: syntax error at end of input
           Position: 53
           ERROR: syntax error at end of input
           Position: 53


CREATE TABLE employees (
 employee_id serial PRIMARY KEY,
 full_name VARCHAR NOT NULL,
 manager_id INT
);

INSERT INTO employees (
 employee_id,
 full_name,
 manager_id
)
VALUES
 (1, 'Michael North', NULL),
 (2, 'Megan Berry', 1),
 (3, 'Sarah Berry', 1),
 (4, 'Zoe Black', 1),
 (5, 'Tim James', 1),
 (6, 'Bella Tucker', 2),
 (7, 'Ryan Metcalfe', 2);
 

WITH emp AS (
select * from rikke_hammer.employees)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #15606: Postgres incorrectly returns syntax error when using WITH clacuse
@ 2019-01-23 14:45  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2019-01-23 14:45 UTC (permalink / raw)
  To: newsx@outlook.com; pgsql-bugs@lists.postgresql.org

On Wed, Jan 23, 2019 at 7:40 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:      15606
> Logged by:          Rikke Hammer
> Email address:      newsx@outlook.com
> PostgreSQL version: 11.1
> Operating system:   Windows 10 Home  version1803 x64
> Description:
>
> I get a syntax error when I try to use a WITH clause in a query. Below is a
> simple test query. It (as as well as any other WITH clause query I do,
> creates the following error:
>
>           SQL Error [42601]: ERROR: syntax error at end of input
>           Position: 53
[...]
> WITH emp AS (
> select * from rikke_hammer.employees)

If you actually just want to execute the query you are putting into
the WITH what is the point of wrapping it with "WITH"?

This is not a bug.  As the error message indicates the parser is
expecting you to write more sql stuff.  In this case a SELECT
statement that actually uses the emp CTE

[ WITH [ RECURSIVE ] with_query [, ...] ]
SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
...

David J.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-01-23 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 13:18 BUG #15606: Postgres incorrectly returns syntax error when using WITH clacuse PG Bug reporting form <noreply@postgresql.org>
2019-01-23 14:45 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox