Create a virtual table from joined PostgreSQL tables

Join related PostgreSQL tables in the virtual table wizard, select their columns, and verify the resulting records in Mainbase.

Use a joined view to display columns from related PostgreSQL tables together. For example, start with an orders table and include the customer name from customers using the order’s customer ID. Start with an active PostgreSQL connection whose database account can read both tables.

Choose the join and its columns

  1. Start creating a PostgreSQL virtual table. Choose the schema and the table that should provide the base rows, such as orders.
  2. In Define Relationships, select Build joined view. Under Suggested tables, select the path that connects the base table and the table whose fields you need. If several paths are available, check that you chose the relationship that matches your task.
  3. Under Column selection, clear Include all columns for each table you want to narrow. Keep the columns you need for the result and for checking known records. Mainbase generates the query from these selections.

If the table you need is missing from the suggestions, check that the connection can read it and that the database defines the expected foreign key. You can also ask your database administrator for a reporting view and connect it as a virtual table.

Verify the virtual table

  1. In Map Fields, check the type and label of the fields you plan to use. In Preview Data, look for a field from the joined table and compare it with a known base record. If you see only base-table fields, the wizard may have fallen back to the base preview. Review the relationship and selected columns.
  2. Name the virtual table and select Create Virtual Table. Open it and check that the joined fields have the expected values. A base row with no matching related record can have blank joined fields. If several related records match, the same base row can appear more than once.

Ask Mainbase AI

Ask about any feature in Mainbase. Find a setting, get step-by-step guidance, or troubleshoot a problem.

Open the AI assistant

Copy a question to get started

  • How do I create a Kanban view?
  • How do I invite a teammate?
  • Why is a record missing from this view?