#316 ocp_admin_privileges.pgsql error

1.6.x
open-accepted
Alex Ionescu
tools (25)
5
2010-09-15
2010-09-13
jrudolph
No

the script ocp_admin_privileges.pgsql creates errors with latest psql version 8.4.4

The first problem:
ERROR: relation "admin_id_seq" already exists
ERROR: syntax error at or near "("
LINE 2: id int(10) integer Primary KEY DEFAULT nextval(admin_id_se...
^
SET

Removing the int(10) before the integer declaration moves past this error.

After int(10) removed:

ERROR: relation "admin_id_seq" already exists
ERROR: column "admin_id_seq" does not exist
SET

This was ran against a fresh database install with the only previous entry being "opensipsdbctl create"

The complete script as delivered in the 1.6.3 tarball:

CREATE SEQUENCE admin_id_seq;
CREATE TABLE ocp_admin_privileges (
id int(10) integer Primary KEY DEFAULT nextval(admin_id_seq),
first_name text NOT NULL default '',
last_name text NOT NULL default '',
username text NOT NULL default '',
password text NOT NULL default '',
ha1 text default '',
available_tools text NOT NULL default '',
permissions text default NULL
);
SET CLIENT_ENCODING TO 'latin1' ;

Discussion

  • jrudolph
    jrudolph
    2010-09-13

    Sorry, double post was caused by the browser back button.

     
  • jrudolph
    jrudolph
    2010-09-13

    The following changes correct the script. Changes are removing "int(11)" before integer declaration on line 3 and adding single quotes around admin_id_seq in the nextval() function on line 3.

    CREATE SEQUENCE admin_id_seq;
    CREATE TABLE ocp_admin_privileges (
    id integer Primary KEY DEFAULT nextval('admin_id_seq'),
    first_name text NOT NULL default '',
    last_name text NOT NULL default '',
    username text NOT NULL default '',
    password text NOT NULL default '',
    ha1 text default '',
    available_tools text NOT NULL default '',
    permissions text default NULL
    );
    SET CLIENT_ENCODING TO 'latin1' ;

     
    • assigned_to: nobody --> untiptun
    • status: open --> open-accepted