small dblink patch

Started by Joe Conwayabout 24 years ago4 messagespatches
Jump to latest
#1Joe Conway
mail@joeconway.com

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.

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

Thanks,

Joe

Attachments:

dblink.2002.05.26.1.patchtext/plain; name=dblink.2002.05.26.1.patchDownload+2-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joe Conway (#1)
Re: small dblink patch

Joe Conway <mail@joeconway.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

#3Joe Conway
mail@joeconway.com
In reply to: Joe Conway (#1)
Re: small dblink patch

Tom Lane wrote:

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.

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:

OK - this patch is a bit larger -- followed your advise, and moved
internal declarations from dblink.h to dblink.c while I was at it.

Please apply if there are no more objections.

Thanks,

Joe

Attachments:

dblink.2002.05.27.1.patchtext/plain; name=dblink.2002.05.27.1.patchDownload+123-123
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joe Conway (#3)
Re: small dblink patch

Joe Conway <mail@joeconway.com> writes:

OK - this patch is a bit larger -- followed your advise, and moved
internal declarations from dblink.h to dblink.c while I was at it.
Please apply if there are no more objections.

Done.

regards, tom lane