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

set_config() doesn't accept parameters in the extended mode #17226

Open
neverchanje opened this issue Jun 12, 2024 · 1 comment
Open

set_config() doesn't accept parameters in the extended mode #17226

neverchanje opened this issue Jun 12, 2024 · 1 comment
Labels

Comments

@neverchanje
Copy link
Contributor

Describe the bug

set_config ( setting_name text, new_value text, is_local boolean ) → text

When set_config accepts literals as its parameters, everything runs normally.

set_config('setting_name', 'abc', false);

Howerver, when handling a parameterized query, it does not work:

Query(
  "SELECT set_config('setting_name', $1, false);",
  'abc'
)

This is because the implementation of set_config only accepts string literals:

https://github.com/risingwavelabs/risingwave/blob/d488f65/src/frontend/src/binder/expr/function.rs#L1291-L1298

if let ExprImpl::Literal(literal) = &inputs[0] && let Some(ScalarImpl::Utf8(input)) = literal.get_data()

Error message/log

Only string literal is supported in `setting_name`

To Reproduce

	db, err := sql.Open(DriverName, "postgres://root@localhost:4566/dev?sslmode=disable")
	assert.Nil(t, err)

	_, err = db.QueryContext(context.Background(), "SELECT set_config('search_path', $1, false)", "'$user'")
	assert.Nil(t, err)

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

@neverchanje neverchanje added the type/bug Something isn't working label Jun 12, 2024
@github-actions github-actions bot added this to the release-1.10 milestone Jun 12, 2024
@neverchanje neverchanje removed this from the release-1.10 milestone Jun 14, 2024
Copy link
Contributor

This issue has been open for 60 days with no activity.

If you think it is still relevant today, and needs to be done in the near future, you can comment to update the status, or just manually remove the no-issue-activity label.

You can also confidently close this issue as not planned to keep our backlog clean.
Don't worry if you think the issue is still valuable to continue in the future.
It's searchable and can be reopened when it's time. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant