# ActiveRecord patchset (introducing features such as postgres schema 	support)

**URL:** <https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461>\
**Category:** rubyonrails-core\
**Created:** [August 21, 2008, 2:23pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461 "2008-08-21T14:23:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Sindelar](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Adam\_Sindelar](https://discuss.rubyonrails.org/u/Adam_Sindelar)\
**Post date:** [August 21, 2008, 2:23pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/1 "2008-08-21T14:23:38Z")

</div>

Hi.

Our company is currently working on a large government contract to develop an elearning system using Ruby on Rails. To support our needs, we have added numerous useful features to ActiveRecord over the past year or so; they include things such as proper support for PostgreSQL schemas, saving binary data in PostgreSQL (currently broken as of Rails 2.1), SQL reflection for stored procedures, calling stored procedures using ActiveRecord, support for serializing (to\_xml or to\_json) objects of multiple classes into the same array... Now, my employer is seriously considering allocating person-hours for us to work with the Rails core team to get our patches included in trunk.

We believe our changes to be quite useful, and consider it only fair that we should give back to the community around this great project. The question is, whether you would be interested in helping us with this process, and including this functionality.

Thanks, I'll look forward to your replies, Adam

---

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [August 21, 2008, 7:08pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/2 "2008-08-21T19:08:12Z")

</div>

Hi Adam,

We'd love to work with you guys to merge your patches. Do you have a github fork where we can peruse the changes?

Best, jeremy

---

<div class="post-metadata">

**Author:** ![Adam\_Sindelar](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Adam\_Sindelar](https://discuss.rubyonrails.org/u/Adam_Sindelar)\
**Post date:** [August 21, 2008, 9:24pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/3 "2008-08-21T21:24:10Z")

</div>

Hi again,

We don’t have a public fork right now, and it will take some time for things to get moving in the company. I’m sorry about this process, I need to show my superiors that there’s interest on your side for them to green-light the budget for this. I’ll make sure to post back here as soon the person-hours budget is approved and we can work out what would work best.

Thanks for your interest, I look forward to working with you guys.

Adam

---

<div class="post-metadata">

**Author:** ![Adam\_Sindelar](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Adam\_Sindelar](https://discuss.rubyonrails.org/u/Adam_Sindelar)\
**Post date:** [August 23, 2008, 2:42pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/4 "2008-08-23T14:42:20Z")

</div>

Hello yet again,

I'm permitted by my superiors to go ahead, but I am going to have to do work on this alone, so things may not go as fast as I'd intended. Nevertheless, I have prepared the first patch that I would like to show to you, and find out what you would have me fix, add, or change. Due to the fact that I am only one person, and cannot possibly hope to prepare the entirety of our repository (nor am I allowed to) for your review in reasonable time, I'm going to have to submit individual patches. Unless you want me to do otherwise, I'm going to stick with the normal patch review process, and have, for now, submitted the first version of this patch here: [#888 Add SQL methods to models - Ruby on Rails - rails](http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/888-add-sql-methods-to-models).

I would appreciate it, if you could review it and let me know what to change.

Cheers, Adam

---

<div class="post-metadata">

**Author:** ![frogstarr78](https://avatars.discourse-cdn.com/v4/letter/f/a5b964/32.png) [@frogstarr78](https://discuss.rubyonrails.org/u/frogstarr78)\
**Post date:** [August 25, 2008, 4:37pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/5 "2008-08-25T16:37:34Z")

</div>

We have also done some work extending the rails postgresql adapter for a legacy database. Specifically, to support postgresql DDL commands in ruby code. Currently it supports dumping and creating database functions, database trigger functions, user defined database types, and creating (not dumping by default) database views.

We created it as a monkey patch plugin for the rails schema\_dumper and postgresql\_adapter and it has worked nicely for us from Rails 1.2.6 to Rails 2.1. The rubyforge site is [http://rubyforge.org/projects/railspgprocs/](http://rubyforge.org/projects/railspgprocs/).

---

<div class="post-metadata">

**Author:** ![frogstarr78](https://avatars.discourse-cdn.com/v4/letter/f/a5b964/32.png) [@frogstarr78](https://discuss.rubyonrails.org/u/frogstarr78)\
**Post date:** [August 25, 2008, 4:56pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/6 "2008-08-25T16:56:16Z")

</div>

I should mention we'd be interested in getting these additions added to the core postgresql adapter if there is a possibility of that. Although I wouldn't want to step on any toes either. We'd be happy to collaborate with Adam and Co. on this also, seeing as he brought it up.

---

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [August 25, 2008, 7:50pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/7 "2008-08-25T19:50:49Z")

</div>

Nice code 🙂 What versions of pg does it work with?

jeremy

---

<div class="post-metadata">

**Author:** ![Hongli\_Lai1](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@Hongli\_Lai1](https://discuss.rubyonrails.org/u/Hongli_Lai1)\
**Post date:** [August 25, 2008, 9:00pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/8 "2008-08-25T21:00:49Z")

</div>

I just want to say, good work. 🙂 I've tried to use Rails with PostgreSQL some time ago and I ran into all sorts of issues. Hopefully these changes will get included in time.

---

<div class="post-metadata">

**Author:** ![Tarmo\_Tanav](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarmo\_Tanav](https://discuss.rubyonrails.org/u/Tarmo_Tanav)\
**Post date:** [August 25, 2008, 9:44pm UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/9 "2008-08-25T21:44:59Z")

</div>

Care to elaborate on the issues?

I'm not aware of any issues with using Postgresql with Rails like one would use Mysql, but ofcourse the more advanced Postgresql features aren't supported by Rails. This sometimes means that for schema one needs to use the :sql format and one also needs to write custom SQL to access certain features, but I wouldn't call those issues, just lack of niceties.

Certain features, as you're probably aware of, like foreign key migrations/dumping, are provided by the Redhill on Rails plugins: [http://www.redhillonrails.org/index.html](http://www.redhillonrails.org/index.html)

---

<div class="post-metadata">

**Author:** ![frogstarr78](https://avatars.discourse-cdn.com/v4/letter/f/a5b964/32.png) [@frogstarr78](https://discuss.rubyonrails.org/u/frogstarr78)\
**Post date:** [August 26, 2008, 1:00am UTC](https://discuss.rubyonrails.org/t/activerecord-patchset-introducing-features-such-as-postgres-schema-support/33461/10 "2008-08-26T01:00:46Z")

</div>

This works on PostgreSQL versions 8.0-8.2
