Skip to content

Commit

Permalink
Append missing system schema to avoid exposing it in show command
Browse files Browse the repository at this point in the history
  • Loading branch information
akrambek committed Feb 7, 2025
1 parent e87d282 commit a9bbd70
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view"
write "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view"
" AS SELECT id, name, description,"
" COALESCE(owner_id, owner_id_header::varchar) as owner_id,"
" COALESCE(created_at, created_at_timestamp::timestamp) as created_at"
Expand Down Expand Up @@ -142,7 +142,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view"
read "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view"
" AS SELECT id, name, description,"
" COALESCE(owner_id, owner_id_header::varchar) as owner_id,"
" COALESCE(created_at, created_at_timestamp::timestamp) as created_at"
Expand Down Expand Up @@ -142,7 +142,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;"
write "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view AS SELECT * FROM cities_source;"
[0x00]
write flush

Expand Down Expand Up @@ -134,7 +134,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;"
read "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view AS SELECT * FROM cities_source;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down Expand Up @@ -134,7 +134,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "DROP MATERIALIZED VIEW weather_view;"
write "DROP MATERIALIZED VIEW zb_catalog.weather_view;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "DROP MATERIALIZED VIEW weather_view;"
read "DROP MATERIALIZED VIEW zb_catalog.weather_view;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;"
write "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view AS SELECT * FROM cities_source;"
[0x00]
write flush

Expand Down Expand Up @@ -134,7 +134,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
write "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;"
read "CREATE MATERIALIZED VIEW IF NOT EXISTS zb_catalog.cities_view AS SELECT * FROM cities_source;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down Expand Up @@ -134,7 +134,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM cities_view;"
read "CREATE SINK zb_catalog.cities_view_sink INTO cities FROM zb_catalog.cities_view;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void onStarted(
select = fieldBuilder.toString();
}

String sqlQuery = String.format(sqlFormat, "%s_view".formatted(name),
String sqlQuery = String.format(sqlFormat, "%s.%s_view".formatted(systemSchema, name),
"SELECT %s FROM %s_source".formatted(select, name));

handler.doExecuteSystemClient(traceId, authorization, sqlQuery);
Expand Down Expand Up @@ -404,15 +404,15 @@ public RisingwaveMacroState onError(
private final class CreateSinkIntoState implements RisingwaveMacroState
{
private final String sqlFormat = """
CREATE SINK %s.%s_view_sink INTO %s FROM %s_view;\u0000""";
CREATE SINK %s.%s_view_sink INTO %s FROM %s.%s_view;\u0000""";

@Override
public void onStarted(
long traceId,
long authorization)
{
String name = command.name();
String sqlQuery = String.format(sqlFormat, systemSchema, name, name, name);
String sqlQuery = String.format(sqlFormat, systemSchema, name, name, systemSchema, name);

handler.doExecuteSystemClient(traceId, authorization, sqlQuery);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ public RisingwaveMacroState onError(
private final class DropMaterializedViewState implements RisingwaveMacroState
{
private final String sqlFormat = """
DROP MATERIALIZED VIEW %s_view;\u0000""";
DROP MATERIALIZED VIEW %s.%s_view;\u0000""";

@Override
public void onStarted(
long traceId,
long authorization)
{
String sqlQuery = String.format(sqlFormat, command.name());
String sqlQuery = String.format(sqlFormat, systemSchema, command.name());
handler.doExecuteSystemClient(traceId, authorization, sqlQuery);
}

Expand Down

0 comments on commit a9bbd70

Please sign in to comment.