PostgreSQL allow us to seperate tables in multiple namespace known as schemas. The default schema search path is public so query such as:-

SELECT * FROM table_name;

Will actually looked into public schemas. The equivalent query would be:-

SELECT * FROM public.table_name;

So, what I did was to add a textfield into system settings form:-

if (!_is_mysql()) {
    $form['pgsql_options'] = array(
      '#type' => 'fieldset',
      '#title' => t('PostgreSQL options'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['pgsql_options']['pgsql_schema'] = array(
      '#type' => 'textfield',
      '#title' => t('PostgreSQL Schema'),
      '#default_value' => variable_get('pgsql_schema', 'public'),
      '#size' => 30,
      '#maxlength' => 255,
      '#description' => t('Comma seperated list of schemas'),
    );
  }

Then I change the query in function dba_get_tables() and theme_dba_database_overview_form(). I had to query the rowcount directly since seperate call through dba_get_row_count($table) would halt the system. This is just a rough idea. I'm sure there's a better way to do this.

CommentFileSizeAuthor
#1 pgsql_schema.patch2.77 KBk4ml
pgsql_schema.patch2.81 KBk4ml

Comments

k4ml’s picture

StatusFileSize
new2.77 KB

Here's a better patch that used {drupal_system_catalog} view like the original in dba_get_tables(). I add a new column tabschema to the view.

jeremy’s picture

Status: Active » Closed (won't fix)

The 5.x branch is no longer supported.