Skip to content

Conversation

ashwaniYDV
Copy link
Contributor

select * from pg_catalog.pg_namespace;
just like Postgres, this must show schemas belonging to the currently selected database only

@Mytherin
Copy link
Collaborator

Thanks for the PR!

it just looks like there is a related CI failure in the force storage tests - could you have a look?

================================================================================
Wrong result in query! (test/sql/pg_catalog/sqlalchemy.test:95)!
================================================================================
SELECT EXISTS (
	SELECT * FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n
	WHERE t.typnamespace = n.oid
	AND t.typname = 'int4'
	AND n.nspname = 'main'
	);
================================================================================
Mismatch on row 1, column EXISTS(SELECT * FROM pg_catalog.pg_type AS t , pg_catalog.pg_namespace AS n WHERE ((t.typnamespace = n.oid) AND (t.typname = 'int4') AND (n.nspname = 'main')))(index 1)
0 <> true
================================================================================
Expected result:
================================================================================
true
================================================================================
Actual result:
================================================================================
0
[1824/3605] (50%): test/sql/pg_catalog/sqlalchemy.test                          
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unittest is a Catch v2.13.7 host application.
Run with -? for options

-------------------------------------------------------------------------------
test/sql/pg_catalog/sqlalchemy.test
-------------------------------------------------------------------------------
/home/runner/work/duckdb/duckdb/test/sqlite/test_sqllogictest.cpp:210
...............................................................................

test/sql/pg_catalog/sqlalchemy.test:95: FAILED:
explicitly with message:
  0

@ashwaniYDV
Copy link
Contributor Author

ashwaniYDV commented Jan 21, 2025

The below query will give a different output when opened in in-memory mode and persistence mode.

SELECT EXISTS (
	SELECT * FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n
	WHERE t.typnamespace = n.oid
	AND t.typname = 'int4'
	AND n.nspname = 'main'
	);

The reason is that in this querySELECT * FROM pg_catalog.pg_type; typnamespace value is equal to

  • 0 when opened in persistence mode
  • memory-db's oid when opened in in-memory mode

So when we restrict the shcemas to return only current_database's schema as done in this PR, when typnamespace is 0 there is no system database's main schema (with oid = 0) to match any rows in the above test's join clause

@Mytherin
Copy link
Collaborator

You can add require noforcestorage to skip the test with force storage

@duckdb-draftbot duckdb-draftbot marked this pull request as draft January 23, 2025 07:30
@ashwaniYDV ashwaniYDV marked this pull request as ready for review January 23, 2025 07:30
@ashwaniYDV
Copy link
Contributor Author

You can add require noforcestorage to skip the test with force storage

Thanks @Mytherin . It worked. Please review

@Mytherin Mytherin merged commit 22727b3 into duckdb:main Feb 6, 2025
50 checks passed
Antonov548 added a commit to Antonov548/duckdb-r that referenced this pull request Feb 26, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
krlmlr pushed a commit to duckdb/duckdb-r that referenced this pull request Mar 5, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 15, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 15, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 17, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
Display schema information of currently selected database only (duckdb/duckdb#15815)
Remove extension definitions to prevent re-compilation of the entire system on commit (duckdb/duckdb#15955)
Throw an error when unsupported commands are used in concurrentloop (duckdb/duckdb#16009)
Benchmark runner: catch and log errors + add support for `retry load N` syntax (duckdb/duckdb#16054)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants