PHPackages                             mfn/cakephp2-postgres-no-meta - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mfn/cakephp2-postgres-no-meta

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

mfn/cakephp2-postgres-no-meta
=============================

A CakePHP2 Postgres database driver without getColumnMeta() support

0.0.6(6y ago)82.2k↓41.7%2MITPHPPHP &gt;=5.6

Since Jan 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mfn/cakephp2-postgres-no-meta)[ Packagist](https://packagist.org/packages/mfn/cakephp2-postgres-no-meta)[ Docs](https://github.com/mfn/cakephp2-postgres-no-meta)[ RSS](/packages/mfn-cakephp2-postgres-no-meta/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

CakePHP2 - Postgres driver with custom adaptions
================================================

[](#cakephp2---postgres-driver-with-custom-adaptions)

This driver was changed in the following ways:

1. The default CakePHP 2.x Postgres driver uses `getColumnMeta` to infer column types from the server. Although the PHP part has been optimized in recent years \[1\], it still incurs an overhead to hit the Postgres database on every call with a query like `SELECT RELNAME FROM PG_CLASS WHERE OID=...` \[2\]

Thus, this implementation is born which foregoes any use of the meta data and simply uses `PDO::FETCH_ASSOC`.

2. There's a problem with special crafted SQL statements which contain the `\`character \[3\] which actually isn't CakePHP specific but a problem of the underlying PDO/PgSQL driver \[4\].

The method `\Postgres::value()` was overriden to apply the special C-style escape operation to strings \[5\].

3. The default PHP/PDO `lastInsertId` always returns a string. This driver is adapted to return an integer if `is_numeric` returns true on it. This allows easier integration with codebases using `strict_types=1`.

Requirements and Installation
=============================

[](#requirements-and-installation)

1. You need at least CakePHP 2.10.12
    For CakePHP &gt;= 2.0 and &lt; 2.10.12 , you can use version `0.0.2` of this package
2. Add the line `"mfn/cakephp2-postgres-no-meta": "^0.0.6"` to your `app/composer.json`
3. Run `php composer.phar require mfn/cakephp2-postgres-no-meta`
4. Load the plugin in `app/Config/bootstrap.php` with the line

```
CakePlugin::load('PostgresNoMeta');
```

4. Use the driver in your `app/Config/database.php`: `PostgresNoMeta.Database/PostgresNoMeta` (instead of `Database/Postgres`)
5. Profit!

Rational
========

[](#rational)

During the switch of a big application from MySQL to Postgres it was discovered that much overhead was lost on Postgres and it was finally discovered that these meta queries incur a measurable overhead.

The individual queries are very fast but, depending on your queries, they may add up until a measurable point.

In our case there were performance improvement of up to 50% without any additional changes except activating this class. YMMV.

A little bit later also found problems with the generated SQL statements, which in special cases were translated from:

```
INSERT INTO models(field) VALUES('\'':1');
```

to

```
INSERT INTO models(field) VALUES('\''$1');
```

before sent to the server, causing various problems.

Further reference
=================

[](#further-reference)

- \[1\] [php/php-src#1534](https://github.com/php/php-src/pull/1534)
- \[2\] [cakephp/cakephp#6036](https://github.com/cakephp/cakephp/issues/6036)
- \[3\] [cakephp/cakephp#10373](https://github.com/cakephp/cakephp/issues/10373)
- \[4\]
- \[5\]

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~232 days

Recently: every ~278 days

Total

6

Last Release

2281d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f0d4e7638e419a48dde77f4c481fb1eb2dbe8f5fe913e68e26269ee7e051ade?d=identicon)[mfn](/maintainers/mfn)

---

Top Contributors

[![mfn](https://avatars.githubusercontent.com/u/87493?v=4)](https://github.com/mfn "mfn (10 commits)")[![johannesnagl](https://avatars.githubusercontent.com/u/610811?v=4)](https://github.com/johannesnagl "johannesnagl (2 commits)")

---

Tags

databasepostgrescakephp

### Embed Badge

![Health badge](/badges/mfn-cakephp2-postgres-no-meta/health.svg)

```
[![Health](https://phpackages.com/badges/mfn-cakephp2-postgres-no-meta/health.svg)](https://phpackages.com/packages/mfn-cakephp2-postgres-no-meta)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)[imsamurai/cakephp-serializable-behaviour

Behavior for saving and reading serialized data from/into database

147.7k3](/packages/imsamurai-cakephp-serializable-behaviour)[sad_spirit/pg_wrapper

Converter of complex PostgreSQL types and an OO wrapper for PHP's pgsql extension

2212.2k2](/packages/sad-spirit-pg-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
