I wrote:
> A fairly common solution to that is to return NULL for bad input,
> but in this case we could just have it return the OID unchanged.
After sleeping on it, I concluded that was a bad idea and we'd
be best off returning NULL for invalid type OIDs. So this is
just about back to Steve's
jian he writes:
> trying to do it this way.
> not sure the following error message is expected.
> SELECT pg_basetype(-1);
> ERROR: cache lookup failed for type 4294967295
Yeah, that's not really OK. You could say it's fine for bogus input,
but we've found over the years that it's better for
jian he writes:
> I noticed psql \dD didn't return the basetype of a domain.
> one of the usage of this feature would be in psql \dD.
Your 0002 will cause \dD to fail entirely against an older server.
I'm not necessarily against adding this info, but you can't just
ignore the expectations for
On Thu, Mar 21, 2024 at 10:34 AM jian he wrote:
>
> On Mon, Mar 18, 2024 at 11:43 PM Tom Lane wrote:
> >
> > Alexander Korotkov writes:
> > > On Mon, Mar 18, 2024 at 2:01 AM jian he
> > > wrote:
> > >> `
> > >> Datum
> > >> pg_basetype(PG_FUNCTION_ARGS)
> > >> {
> > >> Oid oid;
> > >>
>
On Mon, Mar 18, 2024 at 11:43 PM Tom Lane wrote:
>
> Alexander Korotkov writes:
> > On Mon, Mar 18, 2024 at 2:01 AM jian he wrote:
> >> `
> >> Datum
> >> pg_basetype(PG_FUNCTION_ARGS)
> >> {
> >> Oid oid;
> >>
> >> oid = get_fn_expr_argtype(fcinfo->flinfo, 0);
> >>
Alexander Korotkov writes:
> On Mon, Mar 18, 2024 at 2:01 AM jian he wrote:
>> `
>> Datum
>> pg_basetype(PG_FUNCTION_ARGS)
>> {
>> Oid oid;
>>
>> oid = get_fn_expr_argtype(fcinfo->flinfo, 0);
>> PG_RETURN_OID(getBaseType(oid));
>> }
>> `
> Looks good to me. But should it be
On Mon, Mar 18, 2024 at 2:01 AM jian he wrote:
>
> looking at it again.
> I found out we can just simply do
> `
> Datum
> pg_basetype(PG_FUNCTION_ARGS)
> {
> Oid oid;
>
> oid = get_fn_expr_argtype(fcinfo->flinfo, 0);
> PG_RETURN_OID(getBaseType(oid));
> }
> `
>
> if the type is not a domain,
looking at it again.
I found out we can just simply do
`
Datum
pg_basetype(PG_FUNCTION_ARGS)
{
Oid oid;
oid = get_fn_expr_argtype(fcinfo->flinfo, 0);
PG_RETURN_OID(getBaseType(oid));
}
`
if the type is not a domain, work the same as pg_typeof.
if the type is domain, pg_typeof return as is,
On Sun, Feb 18, 2024 at 7:29 AM Tomas Vondra
wrote:
>
>
> Also, now that I looked at the v2 patch again, I see it only really
> tweaked the pg_proc.dat entry, but the code still does PG_GETARG_OID (so
> the "any" bit is not really correct).
>
PG_GETARG_OID part indeed is wrong. so I change to
On Sun, Feb 18, 2024 at 2:49 AM Tomas Vondra
wrote:
>
> An alternative approach would be modifying pg_typeof() to optionally
> determine the base type, depending on a new argument which would default
> to "false" (i.e. the current behavior).
>
> So you'd do
>
> SELECT pg_typeof(x);
>
> or
>
>
Tomas Vondra writes:
> On 2/17/24 20:20, Tom Lane wrote:
>> I don't have an immediate proposal for exactly what to call such a
>> function, but naming it by analogy to pg_typeof would be questionable.
> Are you objecting to the pg_basetypeof() name, or just to it accepting
> "any" argument? I
On 2/17/24 20:20, Tom Lane wrote:
> Tomas Vondra writes:
>> On 2/17/24 01:57, jian he wrote:
>>> On Sat, Feb 17, 2024 at 2:16 AM Tomas Vondra
>>> wrote:
1) We already have pg_typeof() function, so maybe we should use a
similar naming convention pg_basetypeof()?
>
>>> I am ok with
Tomas Vondra writes:
> On 2/17/24 01:57, jian he wrote:
>> On Sat, Feb 17, 2024 at 2:16 AM Tomas Vondra
>> wrote:
>>> 1) We already have pg_typeof() function, so maybe we should use a
>>> similar naming convention pg_basetypeof()?
>> I am ok with pg_basetypeof.
> An alternative approach would
On 2/17/24 01:57, jian he wrote:
> On Sat, Feb 17, 2024 at 2:16 AM Tomas Vondra
> wrote:
>>
>> Hi,
>>
>> On 1/2/24 01:00, jian he wrote:
>>> On Mon, Dec 4, 2023 at 5:11 PM John Naylor wrote:
On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
wrote:
> The one thing
On Sat, Feb 17, 2024 at 2:16 AM Tomas Vondra
wrote:
>
> Hi,
>
> On 1/2/24 01:00, jian he wrote:
> > On Mon, Dec 4, 2023 at 5:11 PM John Naylor wrote:
> >>
> >> On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
> >> wrote:
> >>> The one thing triggering my perfectionism is that the patch does
Hi,
On 1/2/24 01:00, jian he wrote:
> On Mon, Dec 4, 2023 at 5:11 PM John Naylor wrote:
>>
>> On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
>> wrote:
>>> The one thing triggering my perfectionism is that the patch does two
>>> syscache lookups instead of one.
>>
>> For an admin function
On Mon, Dec 4, 2023 at 5:11 PM John Naylor wrote:
>
> On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
> wrote:
> > The one thing triggering my perfectionism is that the patch does two
> > syscache lookups instead of one.
>
> For an admin function used interactively, I'm not sure why that
>
On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
wrote:
> The one thing triggering my perfectionism is that the patch does two
> syscache lookups instead of one.
For an admin function used interactively, I'm not sure why that
matters? Or do you see another use case?
On Thu, Sep 28, 2023 at 11:56 AM Alexander Korotkov
wrote:
>
> The one thing triggering my perfectionism is that the patch does two
> syscache lookups instead of one. In order to fit into one syscache
> lookup we could add "bool missing_ok" argument to
> getBaseTypeAndTypmod(). However,
Hi, Steve!
On Tue, Sep 19, 2023 at 8:36 PM Steve Chavez wrote:
>
> Just to give a data point for the need of this function:
>
> https://dba.stackexchange.com/questions/231879/how-to-get-the-basetype-of-a-domain-in-pg-type
>
> This is also a common use case for services/extensions that require
Just to give a data point for the need of this function:
https://dba.stackexchange.com/questions/231879/how-to-get-the-basetype-of-a-domain-in-pg-type
This is also a common use case for services/extensions that require
postgres metadata for their correct functioning, like postgREST or
Hello hackers,
Currently obtaining the base type of a domain involves a somewhat long
recursive query. Consider:
```
create domain mytext as text;
create domain mytext_child_1 as mytext;
create domain mytext_child_2 as mytext_child_1;
```
To get `mytext_child_2` base type we can do:
```
WITH
22 matches
Mail list logo