diff --git a/src/database/postgres.rs b/src/database/postgres.rs index a2a27bd..ab954b0 100644 --- a/src/database/postgres.rs +++ b/src/database/postgres.rs @@ -482,7 +482,7 @@ impl PostgresPool { ) -> anyhow::Result> { let query = if let Some(filter) = filter { format!( - r#"SELECT to_json({table}.*) FROM "{database}"."{table_schema}"."{table}" WHERE {filter} LIMIT {limit} OFFSET {page}"#, + r#"SELECT to_json("{table}".*) FROM "{database}"."{table_schema}"."{table}" WHERE {filter} LIMIT {limit} OFFSET {page}"#, database = database.name, table = table.name, filter = filter, @@ -492,7 +492,7 @@ impl PostgresPool { ) } else { format!( - r#"SELECT to_json({table}.*) FROM "{database}"."{table_schema}"."{table}" LIMIT {limit} OFFSET {page}"#, + r#"SELECT to_json("{table}".*) FROM "{database}"."{table_schema}"."{table}" LIMIT {limit} OFFSET {page}"#, database = database.name, table = table.name, table_schema = table.schema.clone().unwrap_or_else(|| "public".to_string()),