From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Designing people and organization management for Emacs Date: Fri, 4 Dec 2020 18:21:40 +0300 Message-ID: References: <87zh2tdhdl.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29536"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: help-gnu-emacs@gnu.org, Eric S Fraga To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 04 16:25:05 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klCxE-0007ZQ-JB for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 04 Dec 2020 16:25:04 +0100 Original-Received: from localhost ([::1]:50794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klCxD-00043f-Lg for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 04 Dec 2020 10:25:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klCwt-00043W-Ju for help-gnu-emacs@gnu.org; Fri, 04 Dec 2020 10:24:43 -0500 Original-Received: from static.rcdrun.com ([95.85.24.50]:53249) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klCwr-0007yJ-Kq for help-gnu-emacs@gnu.org; Fri, 04 Dec 2020 10:24:43 -0500 Original-Received: from localhost ([::ffff:197.157.0.57]) (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by static.rcdrun.com with ESMTPSA id 00000000002C0007.000000005FCA54B7.00005D75; Fri, 04 Dec 2020 15:24:38 +0000 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=95.85.24.50; envelope-from=bugs@gnu.support; helo=static.rcdrun.com X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:125977 Archived-At: * Christopher Dimech [2020-12-04 17:52]: > > Yes. I was using text files and spreadsheets, bbdb. Before many years > > I switched to database backed management of any data that is > > structured. And no, org-contacts or BBDB cannot replace the power of > > SQL databases. 204111 contacts are in my database each available at > > few key presses related. > > What would happen for things were database model does not fit the > data? Model is designed based on data to enter in the future. If data changes in the future it is very easy to change the model. Good example with my experience is that few people that I know over long span of years changed their email addresses multiple times. But I do like to have capability to keep those obsolete email addresses as they are still related to the person and emails of the person. By using person's ID I can quickly access all email files. But if I have only 3 fields for email addresses I have no space for 4th and 5th field. Some people make extra table for emails that are related to contact. I like keeping most of information in the contacts (people) table. So what do I do? One option is that I simply add new column to the table where I would store those obsolete email addresses. That column need not be queried to find the "valid" email address. So I do like this: ALTER TABLE data1 ADD COLUMN data_emailsobsolete TEXT[]; That solves the problem, there is new column for obsolete emails. Let me insert few: admin=# INSERT INTO data1 (data_emailsobsolete) VALUES ('{new@example.com,more@example.com}'); INSERT 0 1 admin=# SELECT data_emailsobsolete FROM data1; data_emailsobsolete ------------------------------------ {new@example.com,more@example.com} (2 rows) With that simple SQL instruction problem is solved for many years in advance as the data influenced the model. But user can change to model to anything one wants. To find specific person's ID by using some of obsolete emails is easy: SELECT contacts_id FROM contacts WHERE 'new@example.com' = ANY (contacts_emailsobsolete); data_emailsobsolete ------------------------------------ {new@example.com,more@example.com} (1 row) This is then used by Emacs Lisp function such as: (contact-find-id-by-email "new@example.com") I am often searching for valid emails as such I need to contact people and I used to have 3 booleans fields which say if email address is valid. Sometimes they become valid again after not being valid for some time. In general databases are very easy to adapt to any models. Jean