ORA-01418: specified index does not exist #5050

Open
opened 2026-01-22 14:57:20 +01:00 by admin · 3 comments
Owner

Originally created by @licarigianluca on GitHub (Mar 16, 2016).

hi,
I have a table and i'm trying to add an index on a foreign key in this way:

/**
 *
 * @ORM\Table(name="OPERATORI", indexes={@ORM\Index(name="ixfk_operatori_aziende", columns={"A_ID"})})
 * @ORM\Entity(repositoryClass="AdibaBundle\Repository\AdibaRepository")
 *
 */

    /**
     * @var \AdibaBundle\Entity\Aziende
     *
     * @ORM\ManyToOne(targetEntity="AdibaBundle\Entity\Aziende")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="A_ID", referencedColumnName="ID", nullable=false)
     * })
     */

the output of the command doctrine:schema:update --dump-sql tell me that it have to alter the index specified above.

ALTER INDEX idx_d045244afd251e4c RENAME TO ixfk_operatori_aziende;

And when I run the command doctrine:schema:update --force the database returns me an error

An exception occurred while executing ALTER INDEX idx_38c63d8f3506f80c RENAME TO ixfk_operatori_aziende:

  ORA-01418: specified index does not exist

Why the ORM wants to modify an index that doesn't exists?
And another question.
Where he found the particular index name idx_38c63d8f3506f80c despite I looked for it in my project directory and I haven't found it?

thanks

Originally created by @licarigianluca on GitHub (Mar 16, 2016). hi, I have a table and i'm trying to add an index on a foreign key in this way: ``` php /** * * @ORM\Table(name="OPERATORI", indexes={@ORM\Index(name="ixfk_operatori_aziende", columns={"A_ID"})}) * @ORM\Entity(repositoryClass="AdibaBundle\Repository\AdibaRepository") * */ /** * @var \AdibaBundle\Entity\Aziende * * @ORM\ManyToOne(targetEntity="AdibaBundle\Entity\Aziende") * @ORM\JoinColumns({ * @ORM\JoinColumn(name="A_ID", referencedColumnName="ID", nullable=false) * }) */ ``` the output of the command `doctrine:schema:update --dump-sql` tell me that it have to alter the index specified above. ``` sql ALTER INDEX idx_d045244afd251e4c RENAME TO ixfk_operatori_aziende; ``` And when I run the command `doctrine:schema:update --force` the database returns me an error An exception occurred while executing `ALTER INDEX idx_38c63d8f3506f80c RENAME TO ixfk_operatori_aziende`: ``` ORA-01418: specified index does not exist ``` Why the ORM wants to modify an index that doesn't exists? And another question. Where he found the particular index name `idx_38c63d8f3506f80c` despite I looked for it in my project directory and I haven't found it? thanks
Author
Owner

@licarigianluca commented on GitHub (Mar 16, 2016):

sorry i have forgot to write information about orm version

doctrine/annotations                 v1.2.7             Docblock Annotations Parser
doctrine/cache                       v1.6.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.3.0             Collections Abstraction library
doctrine/common                      v2.6.1             Common Library for Doctrine projects
doctrine/dbal                        v2.5.4             Database Abstraction Layer
doctrine/doctrine-bundle             1.6.2              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.0              Symfony Bundle for Doctrine Cache
doctrine/inflector                   v1.1.0             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.0.5              A small, lightweight utility to instantiate objects in PHP without invoking the...
doctrine/lexer                       v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.5.4             Object-Relational-Mapper for PHP
@licarigianluca commented on GitHub (Mar 16, 2016): sorry i have forgot to write information about orm version ``` doctrine/annotations v1.2.7 Docblock Annotations Parser doctrine/cache v1.6.0 Caching library offering an object-oriented API for many cache backends doctrine/collections v1.3.0 Collections Abstraction library doctrine/common v2.6.1 Common Library for Doctrine projects doctrine/dbal v2.5.4 Database Abstraction Layer doctrine/doctrine-bundle 1.6.2 Symfony DoctrineBundle doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules. doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking the... doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. doctrine/orm v2.5.4 Object-Relational-Mapper for PHP ```
Author
Owner

@Ocramius commented on GitHub (Mar 16, 2016):

Do you have a way to reproduce this bug in isolation, for example by just creating an empty DB with a table, and then applying these mappings to it via doctrine:schema:update --dump-sql?

@Ocramius commented on GitHub (Mar 16, 2016): Do you have a way to reproduce this bug in isolation, for example by just creating an empty DB with a table, and then applying these mappings to it via `doctrine:schema:update --dump-sql`?
Author
Owner

@licarigianluca commented on GitHub (Mar 16, 2016):

i have deleted all the project's entities and i leaved only the entiti operatori,
then i have created the table operatori in an empty database with the command doctrine:schema:update --force. After i add another entity that operatori's foreign key ixfk_operatori_aziende points to. It's colled Aziende. running the command schema:update i have seen this output

CREATE SEQUENCE AZIENDE_ID_seq START WITH 1 MINVALUE 1 INCREMENT BY 1;
CREATE TABLE AZIENDE (BIC_SWIFT1 VARCHAR2(11) DEFAULT NULL NULL, BIC_SWIFT2 VARCHAR2(11) DEFAULT NULL NULL, CAP VARCHAR2(5) DEFAULT NULL NULL, CODICE VARCHAR2(3) DEFAULT NULL NULL, COMUNE VARCHAR2(50) DEFAULT NULL NULL, DATA_FINE DATE NOT NULL, DATA_INIZIO DATE NOT NULL, DESCRIZIONE VARCHAR2(50) NOT NULL, E_MAIL VARCHAR2(100) DEFAULT NULL NULL, FAX VARCHAR2(26) DEFAULT NULL NULL, IBAN1 VARCHAR2(27) DEFAULT NULL NULL, IBAN2 VARCHAR2(27) DEFAULT NULL NULL, INDIRIZZO VARCHAR2(50) DEFAULT NULL NULL, PARTITA_IVA VARCHAR2(26) DEFAULT NULL NULL, PEC VARCHAR2(100) DEFAULT NULL NULL, SIGLA_PROVINCIA VARCHAR2(2) DEFAULT NULL NULL, SITO_WEB VARCHAR2(200) DEFAULT NULL NULL, TELEFONO VARCHAR2(26) DEFAULT NULL NULL, TU_BI VARCHAR2(27) DEFAULT NULL NULL, ID NUMBER(10) NOT NULL, PRIMARY KEY(ID));
COMMENT ON COLUMN AZIENDE.CODICE IS 'es. 201, 202, 203';
COMMENT ON COLUMN AZIENDE.DESCRIZIONE IS 'es. Azienda USL AV Centro';
COMMENT ON COLUMN AZIENDE.TU_BI IS 'T.U. Banca d''Italia';
ALTER TABLE OPERATORI ADD (A_ID NUMBER(10) NOT NULL);
ALTER TABLE OPERATORI ADD CONSTRAINT FK_38C63D8F3506F80C FOREIGN KEY (A_ID) REFERENCES AZIENDE (ID);
CREATE INDEX ixfk_operatori_aziende ON OPERATORI (A_ID);

Then i run the command with the argument --force and everything goes fine.

All these things are very strange.

@licarigianluca commented on GitHub (Mar 16, 2016): i have deleted all the project's entities and i leaved only the entiti operatori, then i have created the table operatori in an empty database with the command `doctrine:schema:update --force`. After i add another entity that operatori's foreign key `ixfk_operatori_aziende` points to. It's colled Aziende. running the command `schema:update` i have seen this output ``` sql CREATE SEQUENCE AZIENDE_ID_seq START WITH 1 MINVALUE 1 INCREMENT BY 1; CREATE TABLE AZIENDE (BIC_SWIFT1 VARCHAR2(11) DEFAULT NULL NULL, BIC_SWIFT2 VARCHAR2(11) DEFAULT NULL NULL, CAP VARCHAR2(5) DEFAULT NULL NULL, CODICE VARCHAR2(3) DEFAULT NULL NULL, COMUNE VARCHAR2(50) DEFAULT NULL NULL, DATA_FINE DATE NOT NULL, DATA_INIZIO DATE NOT NULL, DESCRIZIONE VARCHAR2(50) NOT NULL, E_MAIL VARCHAR2(100) DEFAULT NULL NULL, FAX VARCHAR2(26) DEFAULT NULL NULL, IBAN1 VARCHAR2(27) DEFAULT NULL NULL, IBAN2 VARCHAR2(27) DEFAULT NULL NULL, INDIRIZZO VARCHAR2(50) DEFAULT NULL NULL, PARTITA_IVA VARCHAR2(26) DEFAULT NULL NULL, PEC VARCHAR2(100) DEFAULT NULL NULL, SIGLA_PROVINCIA VARCHAR2(2) DEFAULT NULL NULL, SITO_WEB VARCHAR2(200) DEFAULT NULL NULL, TELEFONO VARCHAR2(26) DEFAULT NULL NULL, TU_BI VARCHAR2(27) DEFAULT NULL NULL, ID NUMBER(10) NOT NULL, PRIMARY KEY(ID)); COMMENT ON COLUMN AZIENDE.CODICE IS 'es. 201, 202, 203'; COMMENT ON COLUMN AZIENDE.DESCRIZIONE IS 'es. Azienda USL AV Centro'; COMMENT ON COLUMN AZIENDE.TU_BI IS 'T.U. Banca d''Italia'; ALTER TABLE OPERATORI ADD (A_ID NUMBER(10) NOT NULL); ALTER TABLE OPERATORI ADD CONSTRAINT FK_38C63D8F3506F80C FOREIGN KEY (A_ID) REFERENCES AZIENDE (ID); CREATE INDEX ixfk_operatori_aziende ON OPERATORI (A_ID); ``` Then i run the command with the argument `--force` and everything goes fine. All these things are very strange.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5050