From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 20918947EB
 for <pmg-devel@lists.proxmox.com>; Thu, 22 Feb 2024 08:34:32 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id F0EC13488
 for <pmg-devel@lists.proxmox.com>; Thu, 22 Feb 2024 08:34:31 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pmg-devel@lists.proxmox.com>; Thu, 22 Feb 2024 08:34:30 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3F94F44A40
 for <pmg-devel@lists.proxmox.com>; Thu, 22 Feb 2024 08:34:30 +0100 (CET)
Message-ID: <c1c41ed8-9e60-46b7-af70-e9685dcc2014@proxmox.com>
Date: Thu, 22 Feb 2024 08:34:28 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Thomas Lamprecht <t.lamprecht@proxmox.com>, pmg-devel@lists.proxmox.com
References: <20240221122439.1281024-1-d.csapak@proxmox.com>
 <20240221122439.1281024-5-d.csapak@proxmox.com>
 <978790ad-0acb-4207-ad3b-7cda36ce6921@proxmox.com>
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <978790ad-0acb-4207-ad3b-7cda36ce6921@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.019 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [postgresql.org]
Subject: Re: [pmg-devel] [PATCH pmg-api v2 04/10] add rule attributes
 and/invert (for each relevant type)
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 22 Feb 2024 07:34:32 -0000



On 2/22/24 07:46, Thomas Lamprecht wrote:
> Am 21/02/2024 um 13:24 schrieb Dominik Csapak:
>> +my $rule_attributes_cmd = <<__EOD;
>> +    CREATE TABLE Rule_Attributes (
>> +      Rule_ID INTEGER NOT NULL,
>> +      Name VARCHAR(20) NOT NULL,
>> +      Value BYTEA NULL,
> 
> FWIW, with this being such limited to only support a boolean value, the
> name could have been a boolean type for invert/and too..
> 
> Else it would make more sense to have this either more generic, or make
> it a very explicit table (name) like "Rule_Flags".
> 
> As of now the name suggests that its generic, but the schema really isn't.
> I.e., this feels a bit like the worst of both worlds.
> 

huh? i'm not sure i understand completely what you want to say:

Value is a BYTEA is a 'binary string' [0]
so we can store arbitrary information there, not only booleans
(i reused the data types we already have for the 'Attribut' table, which
stores attributes for the Objects, e.g. for the Notify Action)



0: https://www.postgresql.org/docs/current/datatype-binary.html