[SQL] function array_to_string(text[]) does not exist

2013-08-25 Thread Victor Sterpu
Hello When I run : SELECT array_to_string(array_agg(CONCAT(CAST (ltrv1.val_min AS CHAR), '-', CAST(ltrv1.val_max AS CHAR), ' ', ltrv1.comentarii))) FROM lab_tests_reference_values ltrv1 GROUP BY ltrv1.val_min, ltrv1.val_max, ltrv1.comentarii; I get the error: ERROR: function array_to_string(t

[SQL] ZIP function

2013-03-16 Thread Victor Sterpu
Is there a function that will give the resulting zip content for a string? Like SELECT zip('test data');? Thank you.

[SQL] Trigger triggered from a foreign key

2012-10-19 Thread Victor Sterpu
I have this trigger that works fine. The trigger prevents the deletion of the last record. But I want skip this trigger execution when the delete is done from a external key. How can I do this? This is the fk ALTER TABLE focgdepartment ADD CONSTRAINT fk_focgdep_idfocg FOREIGN KEY (idfocg)

Re: [SQL] Need help with a special JOIN

2012-09-29 Thread Victor Sterpu
This is a way to do it, but things will change if you have many attributes/object SELECT o.*, COALESCE(a1.value, a2.value) FROM objects AS o LEFT JOIN attributes AS a1 ON (a1.object_id = o.id) LEFT JOIN attributes AS a2 ON (a2.object_id = 0); On 29.09.2012 19:02, Andreas wrote: Hi, asume I've

[SQL] Selecting data from XML

2012-07-16 Thread Victor Sterpu
If I have a XML like this can I write a query that will output the columns names and values like this? code;validFrom;validTo -- CLIN102;1980-02-23; CLIN103;1980-02-23;2012-01-01 Thank you -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make ch