We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi! I have experienced exceptions during inserts. It was weird, because out of approx 1B inserts, there were only few that failed on this exception:
In Statement.php line 172: DatabaseException: default: Cannot execute query in readonly mode. (READONLY)
After some debugging i was able to create minimal query to replicate the problem:
INSERT INTO `log` (`response_body`) VALUES ('{a:b}')
TLDR: the query will match regexp in \ClickHouseDB\Query\Query::isUseInUrlBindingsParams()
\ClickHouseDB\Query\Query::isUseInUrlBindingsParams()
public function isUseInUrlBindingsParams():bool { // 'query=select {p1:UInt8} + {p2:UInt8}' -F "param_p1=3" -F "param_p2=4" return preg_match('#{[\w+]+:[\w+()]+}#',$this->sql); }
Then it removes the readonly: 0 default value - readonly=1 will be added to the database connection URL.
readonly: 0
readonly=1
How to replicate:
/** @var \ClickHouseDB\Client $clickhouse */ $clickhouse->insert( 'api_log', [['{a:b}']], ['response_body'], );
CREATE TABLE IF NOT EXISTS api_log ( response_body String NOT NULL ) ENGINE = MergeTree()
Expected behaviour - readonly: 0 in the URL (just changed value from {a:b} to {a: b}
{a:b}
{a: b}
Working workaround - adds space after : in the whole query if it matches the regexp:
:
preg_replace('#{([\w+]+):([\w+()]+)}#', '{$1: $2}', $value);
Is there any way, other than modify the string value inserting? Thank you
The text was updated successfully, but these errors were encountered:
@JanMikes you can try https://github.com/simPod/PhpClickHouseClient since there's no magic between usercode and issuing request so it might suite you better.
Sorry, something went wrong.
Same here
Merge pull request #203 from MakarMS/master
0d91abe
fix(#202): Fix converting boolean when inserting into int and fix(#194): Fix unexpected readonly mode with specific string in query
A fix has been made
No branches or pull requests
Hi! I have experienced exceptions during inserts. It was weird, because out of approx 1B inserts, there were only few that failed on this exception:
After some debugging i was able to create minimal query to replicate the problem:
TLDR: the query will match regexp in
\ClickHouseDB\Query\Query::isUseInUrlBindingsParams()
Then it removes the
readonly: 0
default value -readonly=1
will be added to the database connection URL.How to replicate:
Expected behaviour - readonly: 0 in the URL (just changed value from
{a:b}
to{a: b}
Working workaround - adds space after
:
in the whole query if it matches the regexp:Is there any way, other than modify the string value inserting? Thank you
The text was updated successfully, but these errors were encountered: