Re: FW: Getting information about sequences

Lists: pgsql-general
From: "Forums (at) Existanze" <forums(at)existanze(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: FW: Getting information about sequences
Date: 2006-05-16 07:04:57
Message-ID: 200605160704.k4G74e6H028453@auth-smtp.hol.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Hello all again,

Thank you for all of your replies,

We are creating a jdbc backup solution that does NOT require the pgdump
program.
We have managed to get it going pretty fast, and the output size at the
moment is rellativelly smaller, but anyway. Most of the key information you
can get from the driver, like primary, foreign keys, but we have a problem
when we restore this information back.

We totally destroy the database being restored and create a new one from
scratch with the information from the backup we took. We need to get the
sequences to the proper value. So at the moment the way we are doing it is
during the backup we get all the sequences from the database, then we get
the primary keys for all the tables, map them using
'table_name'_'id_name'_seq and issue the following command for each sequence
SELECT setval('sequence', (SELECT MAX('id_name') from 'table_name')); during
the restore.

At the moment it works, but it is too sloppy, and apparently not that easy.
As to the temporary table it is not a solution. Because it will not always
be available. The user can backup the info and move to another country(which
is what is happening) and restore this same information on another location.
Part of some requirement.

Once again Thank you all for your replies,

Best Regards,
Fotis

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
> Sent: 15 May 2006 18:11
> To: Martijn van Oosterhout
> Cc: Forums @ Existanze; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Getting information about sequences
>
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > On Mon, May 15, 2006 at 10:44:15AM -0400, Tom Lane wrote:
> >> I haven't been able to think of a way to do that, unless
> you want to
> >> assume the existence of a plpgsql helper function.
> There's an open
> >> request to list last_values in psql's "\ds", and it'd be
> real nice to
> >> be able to do it all in one query for that.
>
> > Long term I see a few ways of dealing with this:
> > [ ideas snipped ]
>
> Yeah (actually the point about the update-in-place code being relevant
> had just occurred to me too). However, none of these are really
> desirable solutions from psql's point of view, because they could only
> work in 8.2 and later (or whenever we implemented them). It'd be
> nicer if \ds still worked against back-rev servers, which means we
> need a solution that works with the current server API. I'm thinking
> that psql will need to pull the main \ds query result, and then
> manually issue a select against each of the sequences (ick). On the
> other hand this may be the best thing anyway, since it's entirely
> likely that some of those selects would fail for permissions reasons,
> and we don't want the whole \ds operation to go down in flames just
> because you don't have select rights on one sequence.
>
> regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Forums (at) Existanze" <forums(at)existanze(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FW: Getting information about sequences
Date: 2006-05-16 14:21:36
Message-ID: 12028.1147789296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

"Forums @ Existanze" <forums(at)existanze(dot)com> writes:
> We are creating a jdbc backup solution that does NOT require the pgdump
> program.

In heaven's name, WHY?

Do you have any idea how much future pain you are setting yourself up
for? pg_dump changes with every PG release to deal with new features
and changes in the system catalogs. Read the CVS logs for pg_dump for
the past few years, then ask yourself if you really want to buy into a
comparable amount of ongoing maintenance effort.

You'd be way better off just invoking pg_dump as a subprocess. If there
are specific features you need that pg_dump doesn't have (eg, dumping
just selected tables) consider helping to add them.

regards, tom lane


From: "Forums (at) Existanze" <forums(at)existanze(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: FW: Getting information about sequences
Date: 2006-05-16 14:31:44
Message-ID: 200605161431.k4GEVQxa018879@auth-smtp.hol.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Does pg_dump run in Macintosh?

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: 16 May 2006 17:22
> To: Forums @ Existanze
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: FW: [GENERAL] Getting information about sequences
>
> "Forums @ Existanze" <forums(at)existanze(dot)com> writes:
> > We are creating a jdbc backup solution that does NOT require the
> > pgdump program.
>
> In heaven's name, WHY?
>
> Do you have any idea how much future pain you are setting
> yourself up for? pg_dump changes with every PG release to
> deal with new features and changes in the system catalogs.
> Read the CVS logs for pg_dump for the past few years, then
> ask yourself if you really want to buy into a comparable
> amount of ongoing maintenance effort.
>
> You'd be way better off just invoking pg_dump as a
> subprocess. If there are specific features you need that
> pg_dump doesn't have (eg, dumping just selected tables)
> consider helping to add them.
>
> regards, tom lane
>


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Forums (at) Existanze" <forums(at)existanze(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FW: Getting information about sequences
Date: 2006-05-16 14:45:42
Message-ID: 20060516144542.GF976@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

pg_dump runs on any platform postgres does.

On Tue, May 16, 2006 at 05:31:44PM +0300, Forums @ Existanze wrote:
> Does pg_dump run in Macintosh?
>
>
>
> > -----Original Message-----
> > From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> > Sent: 16 May 2006 17:22
> > To: Forums @ Existanze
> > Cc: pgsql-general(at)postgresql(dot)org
> > Subject: Re: FW: [GENERAL] Getting information about sequences
> >
> > "Forums @ Existanze" <forums(at)existanze(dot)com> writes:
> > > We are creating a jdbc backup solution that does NOT require the
> > > pgdump program.
> >
> > In heaven's name, WHY?
> >
> > Do you have any idea how much future pain you are setting
> > yourself up for? pg_dump changes with every PG release to
> > deal with new features and changes in the system catalogs.
> > Read the CVS logs for pg_dump for the past few years, then
> > ask yourself if you really want to buy into a comparable
> > amount of ongoing maintenance effort.
> >
> > You'd be way better off just invoking pg_dump as a
> > subprocess. If there are specific features you need that
> > pg_dump doesn't have (eg, dumping just selected tables)
> > consider helping to add them.
> >
> > regards, tom lane
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


From: "Forums (at) Existanze" <forums(at)existanze(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: FW: Getting information about sequences
Date: 2006-05-16 14:51:20
Message-ID: 200605161451.k4GEp1SV025244@auth-smtp.hol.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Here is the thing, the user doesn't have Postgres installed on his/her
computer. So how am I going to distribute pg_dump, from my understandin you
have to compile postgres on a Mac in order to get the pgdump executable. And
is this for every version of Mac?

> -----Original Message-----
> From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
> Sent: 16 May 2006 17:46
> To: Forums @ Existanze
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: FW: [GENERAL] Getting information about sequences
>
> pg_dump runs on any platform postgres does.
>
> On Tue, May 16, 2006 at 05:31:44PM +0300, Forums @ Existanze wrote:
> > Does pg_dump run in Macintosh?
> >
> >
> >
> > > -----Original Message-----
> > > From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> > > Sent: 16 May 2006 17:22
> > > To: Forums @ Existanze
> > > Cc: pgsql-general(at)postgresql(dot)org
> > > Subject: Re: FW: [GENERAL] Getting information about sequences
> > >
> > > "Forums @ Existanze" <forums(at)existanze(dot)com> writes:
> > > > We are creating a jdbc backup solution that does NOT
> require the
> > > > pgdump program.
> > >
> > > In heaven's name, WHY?
> > >
> > > Do you have any idea how much future pain you are setting
> yourself
> > > up for? pg_dump changes with every PG release to deal with new
> > > features and changes in the system catalogs.
> > > Read the CVS logs for pg_dump for the past few years, then ask
> > > yourself if you really want to buy into a comparable amount of
> > > ongoing maintenance effort.
> > >
> > > You'd be way better off just invoking pg_dump as a
> subprocess. If
> > > there are specific features you need that pg_dump doesn't
> have (eg,
> > > dumping just selected tables) consider helping to add them.
> > >
> > > regards, tom lane
> > >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org
> so that your
> > message can get through to the mailing list cleanly
>
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org>
> http://svana.org/kleptog/
> > From each according to his ability. To each according to
> his ability to litigate.
>


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: "Forums (at) Existanze" <forums(at)existanze(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FW: Getting information about sequences
Date: 2006-05-16 15:20:23
Message-ID: 4469EDB7.3040507@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Forums @ Existanze wrote:
> Does pg_dump run in Macintosh?

<sarcasm>
Wait.... you are going to "creating a jdbc backup solution" that does
NOT require the pgdump program, and you don't know if pg_dump runs on
Macintosh?
</>

PostgreSQL operates on every major OS platform. I strongly suggest you
read the docs.

Joshua D. Drake
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/


From: "Gavin M(dot) Roy" <gmr(at)ehpg(dot)net>
To: "Forums (at) Existanze" <forums(at)existanze(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting information about sequences
Date: 2006-05-16 15:37:22
Message-ID: EDBDE3E1-A5A0-4B27-A05B-851724532BF7@ehpg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Do you mean every version of OS X? I will not run on OS 9, afaik.
It can be compiled against any version of OS X, again as far as I know.

Gavin

On May 16, 2006, at 7:51 AM, Forums @ Existanze wrote:

> Here is the thing, the user doesn't have Postgres installed on his/her
> computer. So how am I going to distribute pg_dump, from my
> understandin you
> have to compile postgres on a Mac in order to get the pgdump
> executable. And
> is this for every version of Mac?
>
>
>> -----Original Message-----
>> From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
>> Sent: 16 May 2006 17:46
>> To: Forums @ Existanze
>> Cc: pgsql-general(at)postgresql(dot)org
>> Subject: Re: FW: [GENERAL] Getting information about sequences
>>
>> pg_dump runs on any platform postgres does.
>>
>> On Tue, May 16, 2006 at 05:31:44PM +0300, Forums @ Existanze wrote:
>>> Does pg_dump run in Macintosh?
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
>>>> Sent: 16 May 2006 17:22
>>>> To: Forums @ Existanze
>>>> Cc: pgsql-general(at)postgresql(dot)org
>>>> Subject: Re: FW: [GENERAL] Getting information about sequences
>>>>
>>>> "Forums @ Existanze" <forums(at)existanze(dot)com> writes:
>>>>> We are creating a jdbc backup solution that does NOT
>> require the
>>>>> pgdump program.
>>>>
>>>> In heaven's name, WHY?
>>>>
>>>> Do you have any idea how much future pain you are setting
>> yourself
>>>> up for? pg_dump changes with every PG release to deal with new
>>>> features and changes in the system catalogs.
>>>> Read the CVS logs for pg_dump for the past few years, then ask
>>>> yourself if you really want to buy into a comparable amount of
>>>> ongoing maintenance effort.
>>>>
>>>> You'd be way better off just invoking pg_dump as a
>> subprocess. If
>>>> there are specific features you need that pg_dump doesn't
>> have (eg,
>>>> dumping just selected tables) consider helping to add them.
>>>>
>>>> regards, tom lane
>>>>
>>>
>>>
>>> ---------------------------(end of
>>> broadcast)---------------------------
>>> TIP 1: if posting/reading through Usenet, please send an appropriate
>>> subscribe-nomail command to majordomo(at)postgresql(dot)org
>> so that your
>>> message can get through to the mailing list cleanly
>>
>> --
>> Martijn van Oosterhout <kleptog(at)svana(dot)org>
>> http://svana.org/kleptog/
>>> From each according to his ability. To each according to
>> his ability to litigate.
>>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org