[GSOC] questions about idea "rewrite pg_dump as library"

From: 帅 <shuai900217(at)126(dot)com>
To: 'PostgreSQL-development' <pgsql-hackers(at)postgresql(dot)org>
Subject: [GSOC] questions about idea "rewrite pg_dump as library"
Date: 2013-04-10 14:54:03
Message-ID: 71e01949.2e16b.13df4707405.Coremail.shuai900217@126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I'd like to introduce myself to the dev community. I am Shuai Fan, a student from Dalian University of Technology, DLUT , for short, China. And I am interested in working with PostgreSQL project in GSOC2013.
I'm interested in the idea "Rewrite (add) pg_dump and pg_restore utilities as libraries (.so, .dll & .dylib)".

These days, I had a talk with Mr. Pavel Golub by email, the author of this post. And asked some questions about this idea. He adviced me to post the question to this mail list.

My question is:
There are lots of functions in "pg_dump.c". If I rewrite this file as library. I should split "pg_dump.c" into two or more files(Mr. Pavel Golub's advice). However, some functions, do have return value. e.g.

static DumpableObject *createBoundaryObjects(void);

I thought, these functions must get return value through function argument by passing pointer to it, when using library. But, the question is: If I did so, function prototype may be changed. And Mr. Pavel Golub said "it's better to keep all functions with the same declaration", and so "we will only have one code base for both console application and library". I think he is right.
But then, how can I deal with this situation? From my point of view, I can't malloc a variable (e.g. DumpableObject) in one library (e.g. pg_dumplib.so), and then return it's pointer to another library (or excutable program). Maybe, it's not safe(?). Or has something to do with "memory leak"(?). I'm not sure.

Do you have any suggestions?

Best wishes,
Shuai

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dang Minh Huong 2013-04-10 14:56:27 Re: replication_timeout not effective
Previous Message Andres Freund 2013-04-10 14:44:02 Re: [BUGS] replication_timeout not effective