Skip site navigation (1) Skip section navigation (2)

Re: small dblink patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: small dblink patch
Date: 2002-05-27 16:09:55
Message-ID: 13669.1022515795@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Joe Conway <mail(at)joeconway(dot)com> writes:
> Please apply the attached small patch, which fixes a schema related 
> issue with several dblink functions.
> - If the same relation exists in multiple schema, current sources fail 
> to resolve an unqualified relname.
> - Current sources do not allow schema qualified names.

This isn't going to fix the problem --- all the functions are still
declared to take type NAME, which will not be long enough for qualified
names.  You need to replace the use of NAME with use of TEXT.

> The patch fixes both issues by using the (relatively new) regclassin() 
> function to resolve the relname to an Oid.

I don't particularly care for that answer.  Would instead suggest you
borrow the coding now being used in sequence.c and other places where
text arguments are interpreted as relation names:

    text       *seqin = PG_GETARG_TEXT_P(0);
    RangeVar   *sequence;
    Oid         relid;

    sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin,
                                                                "nextval"));

    relid = RangeVarGetRelid(sequence, false);
    // or better, do heap_openrv directly

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Neil ConwayDate: 2002-05-27 19:13:12
Subject: COPY and default values
Previous:From: Joe ConwayDate: 2002-05-27 05:05:49
Subject: small dblink patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group