Can I make direct calls to PostgreSQL server?

Started by Roy Southerabout 25 years ago2 messagesgeneral
Jump to latest
#1Roy Souther
roy@silicontao.com

I am new to this list, forgive me if I do something wrong.

I am writing an application in C++ for Linux to post data to a PostgreSQL
server.
Can I make direct calls to PostgreSQL server? I have a lot of data to post to
the local PostgreSQL server. I am wondering if I can connect directly to it
to post data so I can by pass the extra layers of
command -> SQL text string -> port -> SQL interpreter -> internal DB command
I would like to go
command -> lib function call -> internal DB command

All I can find is examples of how to make long text strings of SQL commands
then pass them to a local port then on into the server. Is this the only way?

--
Roy Souther <roy@silicontao.com>

01100010 10101110 11000110 11010110 00000100 10110010 10010110 11000110
01001110 11110110 11001110 00010110 10010110 00101110 10000100 10000100

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Roy Souther (#1)
Re: Can I make direct calls to PostgreSQL server?

Roy Souther <roy@silicontao.com> writes:

Can I make direct calls to PostgreSQL server? I have a lot of data to post to
the local PostgreSQL server. I am wondering if I can connect directly to it
to post data so I can by pass the extra layers of
command -> SQL text string -> port -> SQL interpreter -> internal DB command
I would like to go
command -> lib function call -> internal DB command

You could issue a COPY FROM STDIN command and then send your data in
COPY format. This assumes that you are setting all the columns
explicitly (COPY doesn't supply defaults for omitted columns, the way
INSERT can) but it saves an awful lot of overhead.

regards, tom lane