This PgSQL table structure

opensips=# \d dbaliases
                                      Table "public.dbaliases"
Column | Type | Collation | Nullable | Default
----------------+-----------------------+-----------+----------+---------------------------------------
id | integer | | not null | nextval('dbaliases_id_seq'::regclass) alias_username | character varying(64) | | not null | ''::character varying alias_domain | character varying(64) | | not null | ''::character varying username | character varying(64) | | not null | ''::character varying domain | character varying(64) | | not null | ''::character varying
Indexes:
   "dbaliases_pkey" PRIMARY KEY, btree (id)
"dbaliases_alias_idx" UNIQUE CONSTRAINT, btree (alias_username, alias_domain)
   "dbaliases_target_idx" btree (username, domain)



volga629

On Fri, Nov 15, 2019 at 15:52, johan <[email protected]> wrote:
That's odd : the primary key is on index and there are no foreign keys.

Can you check if you have the same in your db ?


mysql> describe dbaliases;
+----------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | alias_username | char(64) | NO | MUL | | | | alias_domain | char(64) | NO | | | | | username | char(64) | NO | MUL | | | | domain | char(64) | NO | | | | +----------------+------------------+------+-----+---------+----------------+
 5 rows in set (0.01 sec)

mysql> SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'opensips' AND REFERENCED_TABLE_NAME = 'dbaliases';
 Empty set (0.01 sec)

 mysql>


On 15.11.19 15:31, volga629 via Users wrote:
Hello Everyone,
I am trying use in multi domain environment dbalias table, but hit limitation where impossible insert more then one user per domain.

opensips=# INSERT INTO dbaliases (alias_username, alias_domain, username, domain) VALUES ('4384783197', 'dev-sip.networklab.tld', '452392', 'dev-sip.networklab.tld'); ERROR: duplicate key value violates unique constraint "dbaliases_alias_idx"


We use PgSQL  10

Any help thank you
volga629

_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to