Thread: Patch file questions?

Patch file questions?

From
Casey Havenor
Date:
I'm obviously new.   But making great progress in PostgreSQL with my new
application...

Setup:
I'm running on MAC. 
Postgre 9.0.4 
Virtual Machine with application dev in Linux. 

Problem:
I like many other have come across the inherit issues. 

I found the thread here about such issue... 
http://postgresql.1045698.n5.nabble.com/FK-s-to-refer-to-rows-in-inheritance-child-td3287684.html 

I grabbed the "fk_inheritance.v1.patch" file and have been trying to install
it for the last two hours. 

Where am I suppose to put this file? 
When it asks me for the file to patch what should I input? 
What else am I missing? 

Tore through Google looking for some example and everything I found or tried
didn't work? 

Warmest regards, 

Casey Havenor


--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-file-questions-tp4536025p4536025.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


Re: Patch file questions?

From
Alvaro Herrera
Date:
Excerpts from Casey Havenor's message of mié jun 29 14:24:11 -0400 2011:

> Problem:
>  
> I like many other have come across the inherit issues. 
> 
> I found the thread here about such issue... 
> http://postgresql.1045698.n5.nabble.com/FK-s-to-refer-to-rows-in-inheritance-child-td3287684.html 
> 
> I grabbed the "fk_inheritance.v1.patch" file and have been trying to install
> it for the last two hours. 

I suggest you do not run a patched version of Postgres.  The reason this
patch hasn't been included is that it doesn't completely solve the
problem, it might cause others because it hasn't been fully tested, and
to make matters worse, you are on your own if you run a system with it
because we cannot support you if you have weird problems.

Particularly so if you're new to Postgres.  Doubly so if you're new to
patching source code.

My advice would be to use some other design that does not involve FKs on
inheritance hierarchies.  (Yes, partitioning becomes a hard problem).

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Patch file questions?

From
Casey Havenor
Date:
Partitioning becomes impossible as I'd have to hunt down every single row
from every table within the hierarchy when needed.   I've got an object
driven system with permissions for users so I'll easily have thousands of
rows to manage across 100's of tables. 

For inheritance I'm using it for the following.  ONLY on/with UNIQUE
CONSTRAINTS and FOREIGN KEYS with OIDS enabled - which from my understanding
that shouldn't be an issues as there shouldn't any duplicate entries that
cause a deadlock?   -- So I would think this patch would be ok?  What am i
missing here? 

Is there another way that won't be such a headache - cost tons of man hours
- and still be efficient? 

Either way I'd still like to know how to apply a patch to PostgreSQL just to
satisfy my curiosity? :) 

Thanks for the fast response. 

-----
Warmest regards, 

Casey Havenor
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-file-questions-tp4536031p4536413.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


Re: Patch file questions?

From
Alvaro Herrera
Date:
Excerpts from Casey Havenor's message of mié jun 29 15:53:31 -0400 2011:
> Partitioning becomes impossible as I'd have to hunt down every single row
> from every table within the hierarchy when needed.   I've got an object
> driven system with permissions for users so I'll easily have thousands of
> rows to manage across 100's of tables. 

I suggest you raise this issue on pgsql-sql, -general or maybe
-performance, for design advice.

> Either way I'd still like to know how to apply a patch to PostgreSQL just to
> satisfy my curiosity? :) 

You need the "patch" utility, and either the -p1 or -p0 switch depending
on how the file was built.  When done, recompile.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Patch file questions?

From
Casey Havenor
Date:
Googled patch utility - not sure of which one to get as none I found use the
.patch extensions? 

So is this the workflow...
- Get patch
- Get patch utility - Not sure which one - Any recommendations for Win7,
Mac, Linux? 
- Apply patch to installer for PostgreSQL or after PostgreSQL is installed? 
- Recompile?
- Reinstall? 
- Re-import existing database structure?  --- If I apply this patch - I've
already got a schema built for my database does that mean I'll lose it or
have to import it in?

Never done this have lots of questions... 

Thanks again. 

-----
Warmest regards, 

Casey Havenor
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-file-questions-tp4536031p4536722.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


Re: Patch file questions?

From
Andrew Dunstan
Date:

On 06/29/2011 05:18 PM, Casey Havenor wrote:
> Googled patch utility - not sure of which one to get as none I found use the
> .patch extensions?
>
> So is this the workflow...
> - Get patch
> - Get patch utility - Not sure which one -

On Linux run "man patch". If it's not installed, then install your 
distro's patch package. For example, on Fedora you'd run something like 
"yum install patch".

If you've never done any of this stuff you probably have quite a steep 
learning curve ahead of you.

cheers

andrew


Re: Patch file questions?

From
Casey Havenor
Date:
What recommendations do you have for the other systems? - Win7, Win XP and
Mac?  

Thanks for the info - learning curves don't bother me - love a challenge! 

-----
Warmest regards, 

Casey Havenor
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-file-questions-tp4536031p4537677.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


Re: Patch file questions?

From
Florian Pflug
Date:
On Jun30, 2011, at 07:22 , Casey Havenor wrote:
> What recommendations do you have for the other systems? - Win7, Win XP and
> Mac?

Mac OS X comes with "patch" already installed I think - at least it gets
installed when you install XCode (Apple's IDE), which you need anyway to
get a C compiler (The current XCode version, XCode 4, includes both gcc
and clang, btw.).

If you need additional unix tools on Mac OS X, there's macports
(http://www.macports.org/).

For windows, there's cygwin (http://www.cygwin.com/), which probably also
contains a package for "patch". 

best regards,
Florian Pflug



Re: Patch file questions?

From
Casey Havenor
Date:
Ok - loaded up Linux - fun stuff. 
Figured out how to get the code PostgreSQL version 9.0.4 - Have that in a
directory. 
Got the patch from above... 
Placed into same directory. 

Loaded the dependents for the final compile and install with .configure. 

BUT 

When I run the patch I'm getting some Hunk fails?  Is this because I'm not
using the same version that the author intended the patch for? 

From the output it looks to be going through the files properly but just no
able to inset the new code? 

I've tried ignoring white space and even tried a force - of course I backed
everything up prior to this. :)

-----
Warmest regards, 

Casey Havenor
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Patch-file-questions-tp4536031p4540442.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


Re: Patch file questions?

From
Andrew Dunstan
Date:

On 06/30/2011 07:13 PM, Casey Havenor wrote:
>
> When I run the patch I'm getting some Hunk fails?  Is this because I'm not
> using the same version that the author intended the patch for?
>
>

Yes. Welcome to the world of patch bitrot.

cheers

andrew