Re: [GENERAL] pl/pgsql string combining

2009-12-16 Thread Bino Oetomo
Dear Mr. Stehule Thankyou for your super prompt (came to my mailbox less then 2 minutes since my post) enlightment. I'll try it Sincerely -bino- Pavel Stehule wrote: Hello NULL and any is NULL. So you have to use "coalesce" function. like NEW.prefix = ctrcode || coalesce(NEW.code, '');

[GENERAL] pl/pgsql string combining

2009-12-16 Thread Bino Oetomo
Dear All I have 2 table : 1. hotel_pbx_country 2. hotel_pbx_area Country is one2many to area Area have a field called "prefx" The "prefx" field is auto filled by country.code and area.code and for that purpose, i created trigger and function Trigger- CREATE TRIGGER prefx_xtr

Re: [GENERAL] pgsql 'prefix' error

2009-11-24 Thread Bino Oetomo
Dear Harald Harald Fuchs wrote: At least in prefix 1.0.0 unique indexes seem to be broken. Just drop the primary key and add a separate index: CREATE INDEX myrecords_record_ix ON myrecords USING gist (record); Yup .. it works now. Thankyou for your enlightment Sincerely -bino- -- Sent

[GENERAL] pgsql 'prefix' error

2009-11-24 Thread Bino Oetomo
Dear All Harald Fuchs wrote: For larger tables where an index search would be useful, check out pgfoundry.org/projects/prefix: CREATE TABLE myrecords ( record prefix_range NOT NULL, PRIMARY KEY (record) ); COPY myrecords (record) FROM stdin; 1 12 123 1234 \. I downloaded pgfoundry's p

Re: [GENERAL] How is the right query for this condition ?

2009-11-24 Thread Bino Oetomo
Harald Fuchs wrote: For larger tables where an index search would be useful, check out pgfoundry.org/projects/prefix: ... Wow ... yet another enlightment Thankyou, I realy appreciate Sincerely -bino- -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

Re: [GENERAL] How is the right query for this condition ?

2009-11-22 Thread Bino Oetomo
Dear Sir Brian Modra wrote: You can use a plpgsql to do that e.g. create or replace function getMatchingRecord(vseek text) returns text as $$ declare str text; len integer; ret text; ... I Just try your solution , and it's work like a charm Thankyou for your enlightment Sincerely -bino

[GENERAL] How is the right query for this condition ?

2009-11-22 Thread Bino Oetomo
Dear All Suppose I created a database with single table like this : --start-- CREATE DATABASE bino; CREATE TABLE myrecords(record text); --end and I fill myrecords with this : --start-- COPY myrecords (record) FROM stdin; 1 12 123 1234 \. --end