]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
specify name for pkey constraint and use it in query for cui postgresql 3298/head
authorJakub Jirutka <jakub@jirutka.cz>
Thu, 20 Feb 2020 11:12:09 +0000 (12:12 +0100)
committerJakub Jirutka <jakub@jirutka.cz>
Fri, 28 Feb 2020 14:34:07 +0000 (15:34 +0100)
raddb/mods-config/sql/cui/postgresql/queries.conf
raddb/mods-config/sql/cui/postgresql/schema.sql

index 15e5f2dc4cc23578028d6f436d39dd4ebd00d3e2..cffd99e3e7c4ffe8fcea50d532aebf5b09e74594 100644 (file)
@@ -14,7 +14,7 @@ post-auth {
                VALUES \
                        ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \
                        '%{User-Name}', '%{reply:Chargeable-User-Identity}') \
-               ON CONFLICT (clientipaddress, callingstationid, username) \
+               ON CONFLICT ON CONSTRAINT ${..cui_table}_pkey \
                DO UPDATE SET cui = EXCLUDED.cui, lastaccounting = '-infinity'::timestamp"
 
 }
index f223d0cc98142c1905b4dd03676f5bf6fa545037..bc4129770e89c0d999ae6470b0654e194fb9797a 100644 (file)
@@ -1,3 +1,5 @@
+-- Table for Chargeable-User-Identity.
+-- Note: If you change name of the table, change name of cui_pkey as well.
 CREATE TABLE cui (
        clientipaddress inet NOT NULL DEFAULT '0.0.0.0',
        callingstationid text NOT NULL DEFAULT '',
@@ -5,7 +7,7 @@ CREATE TABLE cui (
        cui text NOT NULL DEFAULT '',
        creationdate timestamp with time zone NOT NULL DEFAULT now(),
        lastaccounting timestamp with time zone NOT NULL DEFAULT '-infinity'::timestamp,
-       PRIMARY KEY (username, clientipaddress, callingstationid)
+       CONSTRAINT cui_pkey PRIMARY KEY (username, clientipaddress, callingstationid)
 );
 
 /* This is an old workaround for upsert which was needed prior PostgreSQL 9.5.