Skip to content

Errors Using replaceRegexpOne() Examples #6402

Description

@theory

The replaceRegexpOne docs feature a couple of examples, but neither works in a newly-fired up ClickHouse 26.3 Docker container:

SELECT DISTINCT
    EventDate,
    replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res
FROM test.hits
LIMIT 7
FORMAT TabSeparated

Received exception from server (version 26.3.12):
Code: 81. DB::Exception: Received from localhost:9000. DB::Exception: Database test does not exist. (UNKNOWN_DATABASE)
SELECT replaceRegexpOne('Hello, World!', '.*', '\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0') AS res

Query id: 6e52f29a-938c-4946-b08f-4041d631ed38

   ┌─res──────────────────┐
1. │ \0\0\0\0\0\0\0\0\0\0 │
   └──────────────────────┘

The output of the second example should be

┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions