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

Unable to set use_table_cache while creating Postgres database with credentials from named collections. #48914

Closed
Soterix opened this issue Apr 18, 2023 · 0 comments · Fixed by #49100 or #49481
Assignees
Labels
potential bug To be reviewed by developers and confirmed/rejected.

Comments

@Soterix
Copy link

Soterix commented Apr 18, 2023

Describe what's wrong

Unable to set use_table_cache=1 while creating Postgres database with credentials from named collections.
Getting an error:

Code: 36. DB::Exception: Unexpected key use_table_cache in named collection. Required keys: database, db, password, user, username, optional keys: addresses_expr, host, hostname, on_conflict, port, schema. (BAD_ARGUMENTS) (version 23.3.1.2823 (official build))

while trying to execute:

CREATE DATABASE local_postgres ENGINE = PostgreSQL(psql, schema = 'information_schema', use_table_cache = 1);

Does it reproduce on recent release?

Yes, reproducible starting from 23.3.1.2823.

How to reproduce

  • Prepare named collection configuration
mkdir ./use_table_cache_bug && cd ./use_table_cache_bug
cat >> named_collections.xml << EOF
<?xml version="1.0"?>
<clickhouse>
  <named_collections>
    <psql>
      <host>host.docker.internal</host>
      <port>15432</port>
      <user>postgres</user>
      <password>testtest</password>
      <database>postgres</database>
    </psql>
  </named_collections>
</clickhouse>
EOF
  • Run a local instance of Postgres
docker run --name some-postgres -p 15432:5432 -e POSTGRES_PASSWORD=testtest -d postgres
  • Run a local instance of Clickhouse 23.3.1.2823, with previously created config:
docker run -d -p 8123:8123 --name some-clickhouse-server --ulimit nofile=262144:262144 -v ${PWD}/named_collections.xml:/etc/clickhouse-server/conf.d/named_collections.xml clickhouse/clickhouse-server:23.3.1.2823
CREATE DATABASE local_postgres ENGINE = PostgreSQL(psql, schema = 'information_schema', use_table_cache = 1);

Expected behavior

Database with engine PostgreSQL should be successfully created.

Error message and/or stacktrace

2023.04.18 20:22:51.102642 [ 48 ] {1a44da8b-a019-43c8-b3e2-4c36d84709fe} <Error> DynamicQueryHandler: Code: 36. DB::Exception: Unexpected key use_table_cache in named collection. Required keys: database, db, password, user, username, optional keys: addresses_expr, host, hostname, on_conflict, port, schema. (BAD_ARGUMENTS), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0xba7e624 in /usr/bin/clickhouse
1. ? @ 0xf0c6760 in /usr/bin/clickhouse
2. ? @ 0xf0c4198 in /usr/bin/clickhouse
3. DB::StoragePostgreSQL::processNamedCollectionResult(DB::NamedCollection const&, bool) @ 0x1098a030 in /usr/bin/clickhouse
4. DB::DatabaseFactory::getImpl(DB::ASTCreateQuery const&, String const&, std::shared_ptr<DB::Context const>) @ 0x10152e68 in /usr/bin/clickhouse
5. ? @ 0x101524f0 in /usr/bin/clickhouse
6. DB::InterpreterCreateQuery::createDatabase(DB::ASTCreateQuery&) @ 0x101312dc in /usr/bin/clickhouse
7. DB::InterpreterCreateQuery::execute() @ 0x1014add8 in /usr/bin/clickhouse
8. ? @ 0x105f6144 in /usr/bin/clickhouse
9. DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::shared_ptr<DB::Context>, std::function<void (DB::QueryResultDetails const&)>, std::optional<DB::FormatSettings> const&) @ 0x105fa5d0 in /usr/bin/clickhouse
10. DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::optional<DB::CurrentThread::QueryScope>&) @ 0x1115d66c in /usr/bin/clickhouse
11. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) @ 0x11160c7c in /usr/bin/clickhouse
12. DB::HTTPServerConnection::run() @ 0x111c09a8 in /usr/bin/clickhouse
13. Poco::Net::TCPServerConnection::start() @ 0x11dfb164 in /usr/bin/clickhouse
14. Poco::Net::TCPServerDispatcher::run() @ 0x11dfc680 in /usr/bin/clickhouse
15. Poco::PooledThread::run() @ 0x11faf73c in /usr/bin/clickhouse
16. Poco::ThreadImpl::runnableEntry(void*) @ 0x11fad004 in /usr/bin/clickhouse
17. ? @ 0x7d5c8 in /usr/lib/aarch64-linux-gnu/libc.so.6
18. ? @ 0xe5d1c in /usr/lib/aarch64-linux-gnu/libc.so.6
 (version 23.3.1.2823 (official build))
@Soterix Soterix added the potential bug To be reviewed by developers and confirmed/rejected. label Apr 18, 2023
@kssenii kssenii self-assigned this Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug To be reviewed by developers and confirmed/rejected.
Projects
None yet
2 participants