Skip site navigation (1) Skip section navigation (2)

Re: Embedding postgresql in my application

From: Murray Cumming <murrayc(at)murrayc(dot)com>
To: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Embedding postgresql in my application
Date: 2006-12-16 11:47:53
Message-ID: 1166269673.5923.17.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Sat, 2006-12-16 at 18:30 +0700, Jeroen T. Vermeulen wrote:
> There is no issue of ports, really.  The way I've described it, you do
> *not* need a TCP port.  Every instance of postgres is running on its own
> socket, which appears in the filesystem in a place of your choosing.

Well, I want multiple users, from multiple networked computers to be
able to use the database simultaneously. TCP/IP seems the logical way to
do this.

> > In this case, I'd actually like the location of the database data to be
> > different every time. The idea would be that it would all be contained
> > in a directory (or even a tarball archive, but that's another issue),
> > along with the .glom file. And opening the .glom file would start a
> > postgres instance with the database that's in that directory.
> 
> That should work fine, but yes, then you do need a separate postgres
> instance running for each of those directories.
> 
> 
> > In my each-database-in-its-directory idea, I guess that I'd do both an
> > initdb (to create the cluster) and a createdb (to create the database,
> > in the cluster, after a createuser) once.
> 
> Yes.  Except for the createuser: if user X owns these directories and
> postgres is started under user identity X, then X is automatically (well,
> by default) the superuser for that database.  No need to create it.

Are we talking about a Linux user or Postgres user as "user X"? I
thought they were separate lists of users.

> > Or do initdb and createdb change anything outside of the specified
> > directory? I mean, can I really move that directory around and just
> > start a postgres instance on it after it's moved, without changes. Are
> > there any absolute filepaths I should watch out for, for instance?
> 
> There's the configuration files, of course, in /etc/postgresql*.  You'll
> have to look up the necessary options to replace those with local
> versions.

Is there no way to put the configuration file in the directory too?

> > Actually, I want passwords. This is not just for the internal use of the
> > application. I want Glom systems to be usable by multiple users
> > simultaneously. That's a big reason why I'm not using sqllite for this.
> 
> That doesn't mean that you have to have passwords, though.  With "ident
> sameuser" you simply rely on the system's authentication--if the system
> says you're user X, then the database accepts you as X, but if the system
> says you're not X, then the database will not accept you as X either. 
> Overall that's probably safer, not less safe, than requiring the user to
> enter a password to log into the database.  And it's lots safer than
> keeping a password stored in a file somewhere.

I don't want to require all users to be using the same Linux user
system, and I even want to allow Windows users to connect when I port
Glom to Windows.

-- 
Murray Cumming
murrayc(at)murrayc(dot)com
www.murrayc.com
www.openismus.com


In response to

Responses

pgsql-interfaces by date

Next:From: Jeroen T. VermeulenDate: 2006-12-16 11:55:51
Subject: Re: Embedding postgresql in my application
Previous:From: Jeroen T. VermeulenDate: 2006-12-16 11:30:15
Subject: Re: Embedding postgresql in my application

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group