25.1. Running the SELECT Command in DuckDB (duckdb.query) #

The duckdb.query stored procedure is useful when the DuckDB syntax makes the command easier to write or to use a function that is not supported by pgpro_axe yet.

Required privileges: All roles.

Execute the following command on the Postgres Pro AXE server:

  SELECT * FROM duckdb.query('command') ON CONFLICT DO NOTHING;

Where command is the SELECT command that must be executed.

Postgres Pro AXE returns the result as rows.

Example 25.1. Executing the duckdb.query Stored Procedure

Using the DuckDB PIVOT syntax that is not valid in Postgres Pro:

  SELECT * FROM duckdb.query('
    PIVOT sales_summary
    ON product_category
    USING SUM(total_sales)
    GROUP BY region;
  ') ON CONFLICT DO NOTHING;