Skip to content

EXCLUDE does not yet support fully-qualified field name #8952

@yoonghm

Description

@yoonghm

What happens?

EXCLUDE modifier inside a SELECT statement does not support . specifier.

To Reproduce

I have the following tables and records:

CREATE TABLE weather (
    city    VARCHAR,
    temp_lo INTEGER, -- minimum temperature on a day
    temp_hi INTEGER, -- maximum temperature on a day
    prcp    REAL,
    date    DATE
);

CREATE TABLE cities (
    city VARCHAR,
    lat  DECIMAL,
    lon  DECIMAL
);

INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27'); 
INSERT INTO weather VALUES ('San Francisco', 43, 57, 0.0 , '1994-11-29');
INSERT INTO weather VALUES ('Hayward'      , 54, 37, null, '1994-11-29');

INSERT INTO cities VALUES ('San Francisco', -194.0, 53.0);

This SQL query works:

SELECT * EXCLUDE (date) FROM weather, cities WHERE weather.city = cities.city;
┌───────────────┬─────────┬─────────┬───────┬───────────────┬───────────────┬───────────────┐
│     city      │ temp_lo │ temp_hi │ prcp  │     city      │      lat      │      lon      │
│    varchar    │  int32  │  int32  │ float │    varchar    │ decimal(18,3) │ decimal(18,3) │
├───────────────┼─────────┼─────────┼───────┼───────────────┼───────────────┼───────────────┤
│ San Francisco │      46 │      50 │  0.25 │ San Francisco │      -194.000 │        53.000 │
│ San Francisco │      43 │      57 │   0.0 │ San Francisco │      -194.000 │        53.000 │
└───────────────┴─────────┴─────────┴───────┴───────────────┴───────────────┴───────────────┘

However, the following SQL query does not work:

SELECT * EXCLUDE (cities.city) FROM weather, cities WHERE weather.city = cities.city;

The error is

Error: Parser Error: syntax error at or near "."
LINE 1: SELECT * EXCLUDE (cities.city) FROM weather, cities WHERE weath...

OS:

Windows

DuckDB Version:

0.8.1

DuckDB Client:

DuckDB CLI

Full Name:

Yoong Hor Meng

Affiliation:

Ngee Ann Polytechnic

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions