Composite types questions

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Composite types questions
Date: 2010-01-11 10:14:10
Message-ID: 3eff28921001110214l887addal4e2b4a3368ccca72@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all.

It's not clear to me how composite values are used in conditions (WHERE/CHECK).
In my case I have something like this:

-- begin snippet

CREATE TABLE test_tab (
col1 timestamp not null,
col2 int8 not null,
col3 text not null
);

CREATE INDEX i_test_tab_col1 ON test_tab( col1 );

SELECT *
FROM test_tab
WHERE (date_trunc('week',col1),col2,col3)=('val1'::timestamp,val2,'val3')
;
-- end snippet

For a number of reasons I cannot split the the WHERE condition in the
"usual" AND-list.
My questions are:
Can the i_test_tab_col1 INDEX be taken into account from the query planner?
What if I define a functional index on col1?
Does the same apply to TABLE-level CHECK conditions?

Thanks in advance.

--
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anton Belyaev 2010-01-11 10:50:47 Re: Huge iowait during checkpoint finish
Previous Message A. Kretschmer 2010-01-11 09:11:51 Re: Custom Field for a table row returned from stored procedure