472,811 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,811 software developers and data experts.

CHAR vs TEXT args

I've created two PL/pgSQL functions with the same name and different
signatures:

CREATE FUNCTION ABC(CHAR) ...
CREATE FUNCTION ABC(TEXT) ....

I intended to call the CHAR-signature function like this:
SELECT ABC('R');

And the TEXT-signature function like this:
SELECT ABC('Right');

But I found that both calls invoke the TEXT-signature function. So is
there any distinction between CHAR and TEXT? Can I somehow specify
that the argument 'R' is to be treated as a CHAR, so the
CHAR-signature version of ABC is executed?

Thanks.
-David
Nov 11 '05 #1
2 1836
David Shadovitz wrote:
I intended to call the CHAR-signature function like this:
SELECT ABC('R');

And the TEXT-signature function like this:
SELECT ABC('Right');

But I found that both calls invoke the TEXT-signature function. So is
there any distinction between CHAR and TEXT? Can I somehow specify
that the argument 'R' is to be treated as a CHAR, so the
CHAR-signature version of ABC is executed?


If you want to force the CHAR version, do something like:
SELECT ABC('R'::char);

See:
http://www.postgresql.org/docs/view....TAX-TYPE-CASTS

HTH,

Joe
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #2
Thanks, Joe and Dennis.

That double-colon type cast did the trick.

As an experienced software engineer, but a newcomer to PostgreSQL, I
appreciate the help.

-David
Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
2
by: tmr_net | last post by:
I'm using the VC++ 2005 beta. I've seen several other suggestions on the message boards, but none even compiled for me....here is my solution: args is a managed String, and the first argument...
5
by: Jason W | last post by:
I have a C# class that I wan't to be able to use in VB6 and VBA applications. To do this I was trying to use a mixed managed VC++ dll and export a function. Doing this I get an error "The memory...
3
by: bg_ie | last post by:
Hi, I am using a API I downloaded from the internet programmed in C. I need the function below which works with this api in my c++ file - void StoreNoteCallback(void *context, int arglen,...
3
by: DG is a god.... | last post by:
Dear All , This is my first post - please go easy...! I have a DLL written in C++ that has the following function exported from it -: char** ListHandles(int *processID); The processID...
9
by: happyvalley | last post by:
I just wonder how to pass arguments to this function with a char** void oldmain(int argv, char**argc) { ........ } void main(void) { int argv;
7
by: Jack | last post by:
Hi, I am having some problems with char and string datatypes. Here is an example int main(){ string str; cout << "enter string: "; cin >str; }
3
Xx r3negade
by: Xx r3negade | last post by:
EDIT: Title is a misnomer, it's not an array it's a pointer I have a struct that I use to pass arguments to a function referenced by pthread_create(). It looks like this: struct...
4
by: Amera | last post by:
hello , I have written these codes : Mydll file : Mydll.h #ifndef MYDLL_H
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.