[GENERAL] PK referenced function

2013-09-06 Thread Agustin Larreinegabe
Hi everyone: I want to know if exists a postgres function or some easy way to know if a PK in a table is already referenced in another table/tables. e.g. I want to delete a row but first I've got to change or delete in the table/tables where is referenced, and I have many table where could be ref

Re: [GENERAL] PK referenced function

2013-09-06 Thread Agustin Larreinegabe
Thanks a lot On Fri, Sep 6, 2013 at 9:51 AM, Michael Paquier wrote: > On Fri, Sep 6, 2013 at 10:26 PM, Agustin Larreinegabe > wrote: > > I want to know if exists a postgres function or some easy way to know if > a > > PK in a table is already referenced in another table/t

Re: [GENERAL] PK referenced function

2013-09-09 Thread Agustin Larreinegabe
schema||'.'||v_foreign_tables.table_name||' where '||v_foreign_tables.column_name||'='||in_id; RETURN QUERY EXECUTE sql; END LOOP; END; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER COST 100 ROWS 1000; On Fri, Sep 6, 2013 at 10:17 A

[GENERAL] Connect postgres to SQLSERVER

2013-09-17 Thread Agustin Larreinegabe
HI, Is there a way to connect to a sqlserver like dblink? I just need to execute a Procedure in sqlserver when something happen -- Gracias - Agustín Larreinegabe

Re: [GENERAL] remove everything before the period

2013-09-18 Thread Agustin Larreinegabe
Try with: Select split_part('897.78','.',2) http://www.postgresql.org/docs/8.4/static/functions-string.html On Tue, Sep 17, 2013 at 11:33 AM, Giuseppe Broccolo < giuseppe.brocc...@2ndquadrant.it> wrote: > Il 17/09/2013 04:21, karinos57 ha scritto: > > Hi, >> I am trying to remove everything be

Re: [GENERAL] Partitioning V schema

2013-09-19 Thread Agustin Larreinegabe
If I were you I will use partitioning. In my experience, partitioning is easier and transparent. I just have to set it up and then refers just to one table and done. About speed, if you have the value "constraint_exclusion" = partition, postgres will examine constraints only for inheritance child t