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

Can't create foreign keys in temporary tables #3860

Closed
2 tasks done
krlmlr opened this issue Jun 15, 2022 · 3 comments · Fixed by #3865
Closed
2 tasks done

Can't create foreign keys in temporary tables #3860

krlmlr opened this issue Jun 15, 2022 · 3 comments · Fixed by #3865
Assignees

Comments

@krlmlr
Copy link
Collaborator

krlmlr commented Jun 15, 2022

What happens?

The syntax CREATE TEMP TABLE y (a int, FOREIGN KEY (a) REFERENCES x (a)) fails with a parser error: "Parser Error: Only TEMPORARY table names can use the "temp" schema"

To Reproduce

CREATE TEMP TABLE x (a int, PRIMARY KEY (a))
CREATE TEMP TABLE y (a int, FOREIGN KEY (a) REFERENCES x (a))
echo "CREATE TEMP TABLE x (a int, PRIMARY KEY (a)); CREATE TEMP TABLE y (a int, FOREIGN KEY (a) REFERENCES x (a));" | build/debug/duckdb
con <- DBI::dbConnect(duckdb::duckdb())

DBI::dbExecute(con, "CREATE TEMP TABLE x (a int, PRIMARY KEY (a))")
#> [1] 0
DBI::dbExecute(con, "CREATE TEMP TABLE y (a int, FOREIGN KEY (a) REFERENCES x (a))")
#> Error: rapi_execute: Failed to run query
#> Error: Parser Error: Only TEMPORARY table names can use the "temp" schema

Created on 2022-06-15 by the reprex package (v2.0.1)

Environment (please complete the following information):

  • OS: macOS
  • DuckDB Version: cdfb9f9
  • DuckDB Client: CLI, R

Before Submitting

  • Have you tried this on the latest master branch?

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

@krlmlr
Copy link
Collaborator Author

krlmlr commented Jun 15, 2022

Trying to remove the code that triggers the warning, checking if tests are failing: https://github.com/krlmlr/duckdb/actions/runs/2499751954.

@Mytherin Mytherin self-assigned this Jun 15, 2022
Mytherin added a commit to Mytherin/duckdb that referenced this issue Jun 15, 2022
…ables, and for now disable support for cross-schema foreign keys
Mytherin added a commit that referenced this issue Jun 15, 2022
Fix #3860: add support for creating foreign keys on temporary tables, and for now disable support for cross-schema foreign keys
@krlmlr
Copy link
Collaborator Author

krlmlr commented Jun 15, 2022

Awesome, thanks! I'll try out very soon.

@krlmlr
Copy link
Collaborator Author

krlmlr commented Jun 16, 2022

Works like a charm locally, now trying in CI/CD: cynkra/dm#1091.

xnge pushed a commit to xnge/duckdb that referenced this issue Jun 23, 2022
bump sqlite

trying to fix build on windows

sqlite bump

add postgres scanner

bump

bump

another bump, windows seems fixed

adding new build process

fingers crossed

almost, need curl

minor bump postgres

bump postgres and rename ci option

postgres bump

trying windows wish me luck

python binary name?

Add job with DUCKDB_R_DEBUG=1

Install pandoc

Fail on NOTEs

Avoid NOTEs

Always print all logs, separately for regular and valgrind

Cleaner output

Extract script, run examples

Rerun scripts/generate_flex.py

Don't check incoming

Disable exit-time-destructors warning in CMake rather than using pragmas

More warning fixes

More CRAN fixes from Hannes

More CRAN fixes

Indentation fixes

library(arrow)

Like this maybe

Remove more regex

s3fs decode keys correctly

Fix generate_series overflow

Add overflow checking to abs operator plus statistics propagation to abs operator that optimizes out the overflow checking

Abs is not an aggregate

Update testthat snapshots

Reenable and fix Arrow tests

Rebuild

Add Arrow to Python regression tests, and time entirety of TPC-H

Allowing cursor to set check threads flag

Don't read the results of threaded queries

Do we have to close the conection so windows doesnt get sad when deleting a db file?

typo + for loops

pass through read only flag for node connector

Issue duckdb#3816: Parquet Time Zones

Only write the time zone for TZ types.

Update parquet_writer.cpp

Expand oss-fuzz tests to run queries and check for internal errors

Format fix

added support for generated columns to TableCatalogEntry->ToSQL()

also tested these situations before exporting

enable static link build for MacOS, hide symbols for linux+mac

switched to RTLD_NOW

give windows the fake rtld flag it deserves

comments, format

use dynamic zlib here

allow to use custom allocator

fix formatting

fix formatting

fix formatting

move assignment operators should be marked noexcept

replace assignment operator to default

Pass through scale and precision for decimal types.

Fixes duckdb#3840

this may work

works on stones (TM)

using make directly to avoid double builds

re-enable dependency

yay python binary names being different everywhere

grr

yay python3

moving external extensions

Fix duckdb#3860: add support for creating foreign keys on temporary tables, and for now disable support for cross-schema foreign keys

Parquet: fix for fixed length byte arrays in dictionary column reader

No more globbing

One more removal

Skip

OSSFuzz fixes

Zero-initialize

Move parameter_count into statement properties

Need to copy properties before

Struct dictionary rework wip

Fix for slice of dictionary vector of structs

Add test_vector_types function, plus vector types tests for lists and structs

Format fix

Tidy fix

Normalify list child in nested comparison

Fix for test_vector_types function with vsize=2

Uncomment out tests

Tidy fix

Increase timeout after adding additional verification code

Fix for create view with prepared statement parameter

Add duckdb namespace to protobuf inlined dependency

getting rid of exports

Add symbol leak test

I wonder if this pass the linux CI

Trying Sams magic

install this guy here as well

Dont run windows substrait extension on extensions CI

Move substrait tests to the right place

woopsie, forgot the require

woopsie, forgot the require

Skip when extension is not built

Checking if this is actually executed

Forgot to set substrait as true here

Not failing if we can't install the substrait stuff

Removing duplicated code and unused var

Update test_ibis_tpch.py

Adding test changes

Accidentaly mixed spaced and tabs

These imports should be out of the try

Making new connections to cursors and adding lock on queries over same connection

Have locks being acquired in correct order

Have locks being acquired in correct order

Make it a nice function

Avoid title is too long error in fuzzer issue submission

Glob with search paths

Move to setting

Tidy fix

Remove the check_tread from python connection

mc

Update bug_report.md

Fix TreeRenderer crash on invalid UTF8

Correctly reset interrupted flag so verification does not overwrite original error

Purge concurrent queue when enqueueing entries to prevent entries from piling up

Fix for issue duckdb#3878

Check query return type instead of query type in dbFetch()

Issue duckdb#3880: Rebind DATE_TRUNC dates

Change the binding of `DATE_TRUNC` results to be `DATE`
when there is a constant part code that has that accuracy.
This also made the code a bit cleaner by separating the
date-level operation from the cast bindings.

added test for 'map' with columns

added first implementation of unique check in map

also detecting unique errors for multiple rows

changed exception type in GetHistogramFunction

adjusted 'write_map.test'

adjusted 'nested_nested_types.test'

adjusted 'test_map_subscript.test', and added/fixed NULL check on MAP

adjusted 'test_null_type.test'

adjusted json tests and 'test_map_cardinality'

adjusted 'write_map.test'

fixed 'test_nested_arrow.py' test

fixed 'test_fetch_nested.py' test

added match to exceptions caught in 'test_fetch_nested.py'

CheckKeyValidity -> AreKeysNull and reworked the structure of the MapFunction a bit

reverted back to a previous commit, using an unordered_set now

reverted changes to ListUnique

passing all tests

accidentally commented out enable_verification

added AreKeysUnique to arrow map conversion

added test that makes sure this exception gets thrown when appropriate

AreKeysUnique now uses Orrify

replaced VerifyKeysUnique and AreKeysNull among others with VerifyMap

changed to NotDistinctFrom, removed unused file

restored and added additional tests for nested keys

VerifyMap now uses a selection vector

test_map uncommented enable_verification

auto -> auto& for ValidityMask variables

make format-master

added 'can_run' check to 'test_map_arrow_to_duckdb'

separated error throwing logic from error detection

Fix sanitization of address sanitizer error

Extract DetectLogicalType()

Add stack trace to errors reported in Julia table functions

Julia v1.6 used to name this differently

Base.catch_stack

Fix duckdb#3896: correctly compute GroupRowsAvailable in struct reader in case a child-entry is not just a list, but a struct with only list entries

Fix SQLancer CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants