Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The SAMPLE key word doesn't work in a subquery. #6668

monetdb-team opened this issue Nov 30, 2020 · 0 comments

The SAMPLE key word doesn't work in a subquery. #6668

monetdb-team opened this issue Nov 30, 2020 · 0 comments


Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2018-12-14 16:05:38 +0100
From: @aris-koning
To: SQL devs <>
Version: 11.31.11 (Aug2018-SP1)
CC: @njnes

Last updated: 2019-01-17 13:49:03 +0100

Comment 26729

Date: 2018-12-14 16:05:38 +0100
From: @aris-koning

User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0
Build Identifier:

It would be nice if the sample keyword works in subqueries. For instance when you want to insert random data into a table with sql.

Reproducible: Always

Steps to Reproduce:

1.create table foo(val int);
2.create table bar(val int);
3.insert into bar (select * from generate_series(0,100)); --works (of course)
4.insert into foo (select * from bar sample 10); --error

Actual Results:

Step the 4. gives an error:
syntax error, unexpected SAMPLE, expecting UNION or EXCEPT or INTERSECT or ')' in: "insert into foo (select * from foo sample"

Expected Results:

That table foo contains 10 values randomly picked from table bar.

Comment 26734

Date: 2018-12-19 11:10:37 +0100
From: @njnes

subqueries with order by, limit and sample work without the brackets.

Comment 26806

Date: 2019-01-17 13:49:03 +0100
From: @aris-koning

This also doesn't work per commit hash 4c2f4c5c4584 (somewhere on current default)
create view foo_view as (select * from foo limit 1);
CREATE VIEW: LIMIT not supported
(It returns this error whether there are brackets or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant