Beginner hacker item: Fix to_reg*() input type

Started by Jim Nasbyover 10 years ago5 messageshackers
Jump to latest
#1Jim Nasby
Jim.Nasby@BlueTreble.com

All the to_reg* functions in src/backend/utils/adt/regproc.c currently
accept a cstring. Per [1]/messages/by-id/29618.1451882238@sss.pgh.pa.us. Note that I mistakenly referred to reg*in functions in that email; it's the to_reg* functions that need to change. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com, they should accept text. This should be a
fairly simple change to make:

- Modify the functions in regproc.c. Take a look at how other text input
functions work to see what needs to happen here (you'll want to use
text_to_cstring() as part of that.)

- Modify the appropriate entries in src/include/catalog/pg_proc.h

[1]: /messages/by-id/29618.1451882238@sss.pgh.pa.us. Note that I mistakenly referred to reg*in functions in that email; it's the to_reg* functions that need to change. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com
Note that I mistakenly referred to reg*in functions in that email; it's
the to_reg* functions that need to change.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Petr Korobeinikov
pkorobeinikov@gmail.com
In reply to: Jim Nasby (#1)
Re: Beginner hacker item: Fix to_reg*() input type

- Modify the functions in regproc.c. Take a look at how other text input
functions work to see what needs to happen here (you'll want to use
text_to_cstring() as part of that.)

- Modify the appropriate entries in src/include/catalog/pg_proc.h

Let me try.
`make check` says "All 160 tests passed.".

Attachments:

pg_proc.difftext/plain; charset=US-ASCII; name=pg_proc.diffDownload+16-16
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Petr Korobeinikov (#2)
Re: Beginner hacker item: Fix to_reg*() input type

Petr Korobeinikov <pkorobeinikov@gmail.com> writes:

- Modify the functions in regproc.c. Take a look at how other text input
functions work to see what needs to happen here (you'll want to use
text_to_cstring() as part of that.)

- Modify the appropriate entries in src/include/catalog/pg_proc.h

Let me try.
`make check` says "All 160 tests passed.".

Pushed, thanks!

(I did make some small adjustments --- in this usage, PG_GETARG_TEXT_PP
is good enough and likely a bit more efficient than PG_GETARG_TEXT_P.)

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Petr Korobeinikov
pkorobeinikov@gmail.com
In reply to: Tom Lane (#3)
Re: Beginner hacker item: Fix to_reg*() input type

2016-01-05 21:04 GMT+03:00 Tom Lane <tgl@sss.pgh.pa.us>:

(I did make some small adjustments --- in this usage, PG_GETARG_TEXT_PP
is good enough and likely a bit more efficient than PG_GETARG_TEXT_P.)

Also I forgot to bump catalog version up. My mishit.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Petr Korobeinikov (#4)
Re: Beginner hacker item: Fix to_reg*() input type

Petr Korobeinikov <pkorobeinikov@gmail.com> writes:

2016-01-05 21:04 GMT+03:00 Tom Lane <tgl@sss.pgh.pa.us>:

(I did make some small adjustments --- in this usage, PG_GETARG_TEXT_PP
is good enough and likely a bit more efficient than PG_GETARG_TEXT_P.)

Also I forgot to bump catalog version up. My mishit.

No, submitted patches generally should not touch catversion (though it's
not a bad idea to mention the need for a bump in the submission message).
If you put in a catversion change, it's generally just going to cause
merge failures, since patches seldom get applied instantly.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers