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

fix : certain db level settings in duckdb can't be set again #6439

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

k-anshul
Copy link
Member

This is just a fix for release blocker. The permanent solution will be as follows:

  1. Most of our settings are global configuration except max_expression_depth.
  2. It seems extensions are now loaded at db level and not connection level. The following code now works:
	_, err = conn1.ExecContext(context.Background(), "INSTALL spatial; LOAD spatial;")
	if err != nil {
		log.Fatal(err)
	}

	row := conn2.QueryRowContext(context.Background(), "SELECT ST_Area('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);")
	var area float64
	err = row.Scan(&area)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(area)
  1. Introduce two new options in rduckdb :
    a. DBInitQueries : Runs for db handle once. Extensions, global configurations and init_sql in connector config will be DBInitQueries.
    b. ConnInitQueries: Runs for each connection. Local configurations will be ConnInitQueries.
  2. After opening DB run DBInitQueries.
  3. Run ConnInitQueries before returning a read or write connection.

@k-anshul k-anshul self-assigned this Jan 16, 2025
@k-anshul k-anshul added the blocker A release blocker issue that should be resolved before a new release label Jan 16, 2025
@k-anshul k-anshul merged commit c3b9bef into main Jan 16, 2025
7 checks passed
@k-anshul k-anshul deleted the fix_db_level_settings branch January 16, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker A release blocker issue that should be resolved before a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants