This is what I did with your help,
So with this function you can know if a PK in table_from is referenced in x
table with CONSTRAINT FOREIGN KEY
Just if someone needs
CREATE OR REPLACE FUNCTION referenced_in (
in_id bigint,
in_schema_from varchar,
in_table_from varchar
)
RETURNS TABLE (
i
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/tables.
> psql has all y
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/tables.
psql has all you want for that. For example in this case:
=# create table aa (a int primary key);
Hi Augustin,
PostgreSQL has a couple of possibilities in this regard.
For example,
http://stackoverflow.com/questions/1152260/postgres-sql-to-list-table-foreign-keyshas
a couple of very clear queries.
Additionally, it would be very useful if you could further clarify the
problem you are trying to
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