PostgreSQL problem

I’ve got a problem with my app when installing into PostgreSQL.
This is part of tables current, and this is the only places where
perp_account_group are mentioned:

‘perp_account’ => array(
‘fd’ => array(
‘account_id’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘7’),
‘account_name’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘255’,‘nullable’ => False),
‘account_group’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’,‘nullable’ => False)
),
‘pk’ => array(‘account_id’),
‘fk’ => array(‘account_group’ => ‘perp_account_group.group_id’),
‘ix’ => array(‘account_group’),
‘uc’ => array()
),
‘perp_account_group’ => array(
‘fd’ => array(
‘group_name’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘255’),
‘group_section’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’,‘nullable’ => False),
‘group_id’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’),
‘asset_or_liability’ => array(‘type’ =>
‘int’,‘precision’ => ‘4’,‘nullable’ => False,‘default’ => ‘1’)
),
‘pk’ => array(‘group_id’),
‘fk’ => array(‘group_section’ =>
‘perp_account_section.section_id’),
‘ix’ => array(‘group_name’,‘group_section’),
‘uc’ => array(‘group_name’)
),

I get the following errors:
CreateTableSQL(‘perp_account_group’,‘group_name C(255), group_section
C(4) NOTNULL, group_id C(4) PRIMARY, asset_or_liability I4 NOTNULL
NOQUOTE DEFAULT 1’) sql=Array ( [0] => CREATE TABLE
"perp_account_group" ( “group_name” VARCHAR(255), "group_section"
VARCHAR(4) NOT NULL, “group_id” VARCHAR(4) NOT NULL,
“asset_or_liability” INT4 DEFAULT 1 NOT NULL, PRIMARY KEY (“group_id”)
) )

ERROR: relation “perp_account_group” already exists

CreateIndexSql(‘perp_account_group_name’,‘perp_account_group’,‘group_name’,Array
( [0] => UNIQUE ) ) sql=Array ( [0] => CREATE UNIQUE INDEX
"perp_account_group_name" ON “perp_account_group” (“group_name”) )

ERROR: “perp_account_group” is an index

CreateIndexSql(‘perp_account_group_section’,‘perp_account_group’,‘group_section’,False)
sql=Array ( [0] => CREATE INDEX “perp_account_group_section” ON
"perp_account_group" (“group_section”) )

ERROR: “perp_account_group” is an index

The errors are fairly clear, but I’m not sure where the already
existing relation or index comes from, and how to fix it.

Nathan



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

Hi Nathan,

you probably have a table perp_account with an index on a column
account_group or group. This index automatically get the name
perp_account_group and Postfix forbids to have a table with the same name.

Ralf

I’ve got a problem with my app when installing into PostgreSQL.
This is part of tables current, and this is the only places where
perp_account_group are mentioned:

‘perp_account’ => array(
‘fd’ => array(
‘account_id’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘7’),
‘account_name’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘255’,‘nullable’ => False),
‘account_group’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’,‘nullable’ => False)
),
‘pk’ => array(‘account_id’),
‘fk’ => array(‘account_group’ => ‘perp_account_group.group_id’),
‘ix’ => array(‘account_group’),
‘uc’ => array()
),
‘perp_account_group’ => array(
‘fd’ => array(
‘group_name’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘255’),
‘group_section’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’,‘nullable’ => False),
‘group_id’ => array(‘type’ =>
‘varchar’,‘precision’ => ‘4’),
‘asset_or_liability’ => array(‘type’ =>
‘int’,‘precision’ => ‘4’,‘nullable’ => False,‘default’ => ‘1’)
),
‘pk’ => array(‘group_id’),
‘fk’ => array(‘group_section’ =>
‘perp_account_section.section_id’),
‘ix’ => array(‘group_name’,‘group_section’),
‘uc’ => array(‘group_name’)
),

I get the following errors:
CreateTableSQL(‘perp_account_group’,‘group_name C(255), group_section
C(4) NOTNULL, group_id C(4) PRIMARY, asset_or_liability I4 NOTNULL
NOQUOTE DEFAULT 1’) sql=Array ( [0] => CREATE TABLE
"perp_account_group" ( “group_name” VARCHAR(255), "group_section"
VARCHAR(4) NOT NULL, “group_id” VARCHAR(4) NOT NULL,
“asset_or_liability” INT4 DEFAULT 1 NOT NULL, PRIMARY KEY (“group_id”)
) )

ERROR: relation “perp_account_group” already exists

CreateIndexSql(‘perp_account_group_name’,‘perp_account_group’,‘group_name’,Array
( [0] => UNIQUE ) ) sql=Array ( [0] => CREATE UNIQUE INDEX
"perp_account_group_name" ON “perp_account_group” (“group_name”) )

ERROR: “perp_account_group” is an index

CreateIndexSql(‘perp_account_group_section’,‘perp_account_group’,‘group_section’,False)
sql=Array ( [0] => CREATE INDEX “perp_account_group_section” ON
"perp_account_group" (“group_section”) )

ERROR: “perp_account_group” is an index

The errors are fairly clear, but I’m not sure where the already
existing relation or index comes from, and how to fix it.

Nathan



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

–
Ralf Becker
Director Software Development

Stylite GmbH
[open style of IT]

Morschheimer Strasse 15
67292 Kirchheimbolanden

fon +49 (0) 6352 70629-0
fax +49 (0) 6352 70629-30
mailto: rb@stylite.de

www.stylite.de
www.egroupware.org


Geschäftsführer Andre Keller,
Gudrun Müller, Ralf Becker
Registergericht Kaiserslautern HRB 30575
Umsatzsteuer-Id / VAT-Id: DE214280951



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

Hi Nathan,

you probably have a table perp_account with an index on a column
account_group or group. This index automatically get the name
perp_account_group and Postfix forbids to have a table with the same name.

That sounds correct. perp_account has a column account group with an index.
Any suggestions on how to fix it? Can I override the automatic index name?



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

You can, but not as easy for an existing index.

If you just added that perp_account_group table, I would suggest to
rename it. That is by far the most easy solution.

Alternatively you could create an update script which drops the old
index and creates a new one with a different name AND modify the
tables_current like:

$phpgw_baseline = array(
‘perp_account’ => array(
‘fd’ => array(
‘group’ => array( …),
// whatever columns …
),
‘pk’ => array(‘group_id’),
‘fk’ => array(),
‘ix’ => array(‘perp_account_group_idx’ => ‘group’),
‘uc’ => array()
),
);

schema_proc class understands that notation to explicitly name an index
(instead of creating a name by appending table- and colum-name).
Unfortunately this is not (yet) supported by db-tools, so you can no
longer use them (or you always have to add the index name again, after
modifying it with db-tools).

Ralf

Hi Nathan,

you probably have a table perp_account with an index on a column
account_group or group. This index automatically get the name
perp_account_group and Postfix forbids to have a table with the same name.

That sounds correct. perp_account has a column account group with an index.
Any suggestions on how to fix it? Can I override the automatic index name?



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

–
Ralf Becker
Director Software Development

Stylite GmbH
[open style of IT]

Morschheimer Strasse 15
67292 Kirchheimbolanden

fon +49 (0) 6352 70629-0
fax +49 (0) 6352 70629-30
mailto: rb@stylite.de

www.stylite.de
www.egroupware.org


Geschäftsführer Andre Keller,
Gudrun Müller, Ralf Becker
Registergericht Kaiserslautern HRB 30575
Umsatzsteuer-Id / VAT-Id: DE214280951



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

You can, but not as easy for an existing index.

If you just added that perp_account_group table, I would suggest to
rename it. That is by far the most easy solution.

Alternatively you could create an update script which drops the old
index and creates a new one with a different name AND modify the
tables_current like:
…

Table / index is about 4 years old, it just never worked on Posgres.
Second one looks like worked, thanks.

Nathan



eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers