Problem with the schema structure produced by Schema module I have a drupal 7.34 installation in my local computer. I also installed schema 7.x-1.2 module. Now

Below is my code:

function myid_schema(){
    $schema = array();  
    $schema['myid_templates'] = array(
        'description' =&gt; 'TODO: please describe this table!',
        'fields' =&gt; array(
            'template_id' =&gt; array(
                'description' =&gt; 'TODO: please describe this field!',
                'type' =&gt; 'serial',
                'not null' =&gt; TRUE,
            ),
           'template_name' =&gt; array(
               'description' =&gt; 'TODO: please describe this field!',
               'type' =&gt; 'varchar',
               'not null' =&gt; FALSE,
           ),
           'portrait' =&gt; array(
               'description' =&gt; 'TODO: please describe this field!',
               'type' =&gt; 'boolean',
               'not null' =&gt; TRUE,
           ),
           'template_width' =&gt; array(
               'description' =&gt; 'TODO: please describe this field!',
               'type' =&gt; 'numeric',
               'not null' =&gt; TRUE,
               'default' =&gt; 0,
               'precision' =&gt; 0,
               'scale' =&gt; 0,
           ),
           'template_height' =&gt; array(
               'description' =&gt; 'TODO: please describe this field!',
               'type' =&gt; 'numeric',
               'not null' =&gt; TRUE,
               'default' =&gt; 0,
               'precision' =&gt; 0,
               'scale' =&gt; 0,
           ),
       ),
       'primary key' =&gt; array('template_id'),
   );
   return $schema;
}

/**
* Implementation of hook_install().
* Perform initial setup tasks.
*/
function myid_install(){
    drupal_install_schema('myid_templates');
}


After installing my module, it throws an error:

Notice: Undefined index: boolean:normal in DatabaseSchema_pgsql-&gt;processField() (line 229 of C:\xampp\htdocs\drupal-7.34\includes\database\pgsql\schema.inc).

PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "NOT" LINE 4: portrait NOT NULL, ^: CREATE TABLE {myid_templates} ( template_id serial, template_name varchar NULL, portrait NOT NULL, template_width numeric(0, 0) NOT NULL default 0, template_height numeric(0, 0) NOT NULL default 0, PRIMARY KEY (template_id) ); Array ( ) in db_create_table() (line 2720 of C:\xampp\htdocs\drupal-7.34\includes\database\database.inc)


Why does it throws an error when my code is copied from the schema structure produced by the schema module? How will I fix it? By the way I'm using postgres.
Drupal doesn't have a boolean type for DB schema, and there's no automatic fallback for a type it doesn't know about, so you end up with the invalid portrait NOT NULL instead of portrait boolean NOT NULL in the create statement.

To fix, just add a pgsql_type to the column. DatabaseSchema_pgsql::processField() knows what to do with it.

'portrait' =&gt; array(
  'description' =&gt; 'TODO: please describe this field!',
  'type' =&gt; 'int', // Keep it portable
  'pgsql_type' =&gt; 'boolean',
  'not null' =&gt; TRUE,
),