473,388 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

7.3 --> 7.4 C Functions



I'm considering writing some functions in C. This is a collection of
approximately 230 functions, mostly in plpgsql at the moment. Number of lines
of plpgsql is approximately 6500 but that'll include all the blank lines used
for spacing code as well as extra lines to allow nicer formating of things such
as queries. The majority are also not terribly complex involving only a small
number of queries/function calls.

The reasons for changing these to C isn't particularly relevent to the list.
However, all this runs on a 7.3 backend and the priority for changing that is
less that the recoding in C, if that goes ahead. So, what I'm interested in is
people's views on how easy it is to port C functions from 7.3 to 7.4. I know
the elog has changed but that's just a bit of leg work, I presume there is
nothing significant in how to use SPI and the normal sort of tuple manipulation
things.
--
Nigel Andrews

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #1
4 1373
"Nigel J. Andrews" <na******@investsystems.co.uk> writes:
So, what I'm interested in is people's views on how easy it is to port
C functions from 7.3 to 7.4. I know the elog has changed but that's
just a bit of leg work, I presume there is nothing significant in how
to use SPI and the normal sort of tuple manipulation things.


AFAIR the only significant change in stuff that ordinary user-defined
functions might want to use is elog() to ereport(). And even there,
you don't really *have* to convert, it just lets you put out better
error messages.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2
Nigel J. Andrews wrote:
However, all this runs on a 7.3 backend and the priority for changing that is
less that the recoding in C, if that goes ahead. So, what I'm interested in is
people's views on how easy it is to port C functions from 7.3 to 7.4. I know
the elog has changed but that's just a bit of leg work, I presume there is
nothing significant in how to use SPI and the normal sort of tuple manipulation
things.


I don't think you'll run into too many issues if your needs are simple.
The only thing that I can think of that you might run into is:

7.3 tuplestore_begin_heap(true, SortMem)
7.4 tuplestore_begin_heap(true, false, SortMem)

And that will only apply if you have an SRF that returns a tuplestore
(contrib/tablefunc as an example). You can continue to use elog in 7.4
-- you just don't get to take advantage of the better ereport functionality.

HTH,

Joe

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

Nov 12 '05 #3


Thanks chaps. That's exactly what I suspected the case to be.

Now if only that glass of wine hadn't gone straight to my head I could get on
and start the conversion process.
Nigel

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4
"Nigel J. Andrews" <na******@investsystems.co.uk> writes:
I'm considering writing some functions in C. This is a collection of
approximately 230 functions, mostly in plpgsql at the moment. Number of lines
of plpgsql is approximately 6500


That's a lot of code. A nice thing would be to write a plpgsql -> C
translator (kind of compiler). Many of the requiered work is already
done by the plpgsql handler and it sounds much more fun and useful in
the long term. Just my $0.2.

Regards,
Manuel.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #5

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

Similar topics

7
by: Piotre Ugrumov | last post by:
I have tried to implement the overload of these 2 operators. ostream & operator<<(ostream &out, Person &p){ out<<p.getName()<<" "<<p.getSurname()<<", "<<p.getDateOfBirth()<<endl; return out; }...
2
by: franklini | last post by:
hello people i. can anybody help me, i dont know what is wrong with this class. it has something to do with the me trying to override the input output stream. if i dont override it, it works fine....
4
by: David Bargna | last post by:
Hi I have a problem, I have a string which needs to be converted to a byte array, then have the string representation of this array stored in an AD attribute. This string attribute then has to...
4
by: Falos425 | last post by:
Okay, I've got a driver.cpp, a section.cpp, and a section.h because I've got a 'section' class. I have an #include <fstream> in the section.h and then section.cpp has an #include "section.h" ...
5
by: Luke | last post by:
Built-in functions don't bind to classes like regular functions. Is this intended? (I do notice that the Python Reference Manual sec 3.2 under "Class Instance" refers to a "user-defined...
2
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! ...
1
by: Javier | last post by:
Hello, thanks for the replies to my questions. I have one more: class A { public: m1() const; m2(); };
8
by: Mike | last post by:
Is it possible to do this in the HTML of the aspx page? <#% if Eval("Name") != null %> write something here <#% else %> show message for missing name <#% end if %> when I try this I get...
5
by: James | last post by:
Hello. I have a problem trying to get seperate image functions to work together. Starting with the img tag and associated html: <img src="image1.jpg" NAME="theImage" pbsrc="image1_lrg.jpg"...
6
by: puzzlecracker | last post by:
Say we have this structure: Struct Foo{ .... friend ostream& operator << (ostream& s, Foo & m); ..... }; friend ostream& operator << (ostream& s, Foo & m){
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.