Re: [SQL] Question on COUNT performance

2010-07-15 Thread REISS Thomas DSIC BIP
Hello, You can add another JOIN in your function to avoid the test to return either true or false. Here's an example: CREATE OR REPLACE FUNCTION f_contact_acl(integer, integer) RETURNS BOOL AS $$ WITH contact (id_contact) AS (VALUES (1),(2),(3),(7),(8)), customer (id_customer,id_org) AS

Re: [SQL] subtract two dates to get the number of days

2010-07-15 Thread Thomas Kellerer
Jean-David Beyer, 14.07.2010 19:05: I just looked them up in my data definitions. Dates are _stored_ as type DATE NOT NULL Very good ;) Yes, if the data happen to be stored at all. But when a program generates the dates dynamically and wants to produce queries from them, it is easier to use