Skip to content

Conversation

carlopi
Copy link
Contributor

@carlopi carlopi commented Jun 12, 2025

Improved version of #17807, using infrastructure from #17866 to check std::stringstream are not used anymore at compile time.

Original problem I had bumped in duckdb-wasm, where there would be some yet to be properly understood factor that would change the global static default locale to an unsupported one that would, via a SQL call to duckdb_tables end up calling a locale-influenced stringstream that would then throw.

Testing can also be done on native applying the following diff, yet to be added as testing mode

diff --git a/test/unittest.cpp b/test/unittest.cpp
index 1c04f9836b..a70847a2a6 100644
--- a/test/unittest.cpp
+++ b/test/unittest.cpp
@@ -30,6 +30,8 @@ int main(int argc, char *argv[]) {
        duckdb::unique_ptr<FileSystem> fs = FileSystem::CreateLocal();
        string test_directory = DUCKDB_ROOT_DIRECTORY;
 
+       std::locale::global(std::locale("ja_JP.SJIS"));
+
        int new_argc = 0;
        auto new_argv = duckdb::unique_ptr<char *[]>(new char *[argc]);
        for (int i = 0; i < argc; i++) {

Also cleans up comment from previous PR review at #17866 (comment)

Note that other streams might (and will) have the same problems, so it would be handy to expand this further, here taking it one step further.

@carlopi carlopi changed the title Deprecated sstream Deprecated std::stringstream Jun 12, 2025
@carlopi carlopi force-pushed the deprecated_sstream branch from aa70d63 to 7b87023 Compare June 12, 2025 08:08
@duckdb-draftbot duckdb-draftbot marked this pull request as draft June 12, 2025 08:09
@carlopi carlopi marked this pull request as ready for review June 12, 2025 08:09
@Mytherin Mytherin merged commit dd2f747 into duckdb:v1.3-ossivalis Jun 12, 2025
52 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

@carlopi carlopi deleted the deprecated_sstream branch June 12, 2025 15:57
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Jun 12, 2025
Deprecated std::stringstream (duckdb/duckdb#17894)
Add support for deserializing multiple json-serialized statements (duckdb/duckdb#17902)
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Jun 12, 2025
Deprecated std::stringstream (duckdb/duckdb#17894)
Add support for deserializing multiple json-serialized statements (duckdb/duckdb#17902)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants