Re: [PATCH] Tiny optmization.

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Tiny optmization.
Date: 2019-11-22 22:29:23
Message-ID: 20191122222923.tohv67an2ia3d3ar@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 22, 2019 at 10:24:05PM +0000, Ranier Vilela wrote:
>Hi,
>pstate is touched here:
>a) BeginCopy line 1489:
> ProcessCopyOptions(pstate, cstate, is_from, options);
>b) ProcessCopyOptions line 1137:
>
> if (format_specified)
> ereport(ERROR,
> (errcode(ERRCODE_SYNTAX_ERROR),
> errmsg("conflicting or redundant options"),
> parser_errposition(pstate, defel->location)));
>

And? The fact that you pass a (possibly NULL) pointer somewhere does not
make that a dereference. And parser_errposition() does this:

if (pstate == NULL || pstate->p_sourcetext == NULL)
return 0;

So I fail to see why this would be an issue?

>best regards.
>Ranier Vilela
>
>________________________________________
>De: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>Enviado: sexta-feira, 22 de novembro de 2019 22:17
>Para: Ranier Vilela
>Cc: pgsql-hackers(at)postgresql(dot)org
>Assunto: Re: [PATCH] Tiny optmization.
>
>Ranier Vilela <ranier_gyn(at)hotmail(dot)com> writes:
>> Redudant because he it's been dereferenced here:
>> line 3410:
>> cstate = BeginCopy(pstate, true, rel, NULL, InvalidOid, attnamelist, options);
>
>Not necessarily ... the rel!=NULL code path there doesn't touch pstate,
>and that seems to be what contrib/file_fdw is relying on.
>
>Arguably, the rel==NULL code path in BeginCopy should be prepared to
>support pstate being null, too. But what you proposed here is certainly
>not OK.
>
> regards, tom lane
>
>

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2019-11-22 22:30:18 Re: backup manifests
Previous Message Ranier Vilela 2019-11-22 22:24:05 RE: [PATCH] Tiny optmization.