[development] A little pgsql help

Piotr Krukowiecki piotr at mallorn.ii.uj.edu.pl
Thu Mar 9 15:09:37 UTC 2006

On Thu, Mar 09, 2006 at 02:46:13AM -0800, Keegan Quinn wrote:
> On Thu, Mar 09, 2006 at 05:37:06AM -0500, Dan Ziemecki wrote:
> >

> DROP TABLE subscriptions_holding; works though.

That one's good.

> > CREATE TABLE subscriptions_holding (
> >   rid int(11) NOT NULL auto_increment COMMENT 'Unique row ID',
> >   content blob NOT NULL COMMENT 'The node array',
> >   type tinytext NOT NULL COMMENT 'New node or comment',
> >   op tinytext NOT NULL COMMENT 'The operation on the node',
> >   uid int(11) NOT NULL default '0' COMMENT 'The person performing the
> > operation',
> >   PRIMARY KEY  ('rid')
> > );

>   content OID NOT NULL,

Why OID?

I would suggest following:

CREATE TABLE subscriptions_holding (
   content text NOT NULL DEFAULT '',
   type text NOT NULL DEFAULT '',
   op text NOT NULL DEFAULT '',
   uid int NOT NULL default 0

I've used 'text' for content, as I think it will contain text only data
(serialized php variables). If you need binary data, then use bytea, but
you'll have to use db_{encode,decode}_blob() functions.

I've also added default values because iirc mysql will insert '' if
there is no default and no value is provided.

I would suggest changing 'uid' name to something else, as it's reserved

> COMMENT ON COLUMN subscriptions_holding.rid IS 'Unique row ID';
> COMMENT ON COLUMN subscriptions_holding.content IS 'The node array';
> COMMENT ON COLUMN subscriptions_holding.type IS 'New node or comment';
> COMMENT ON COLUMN subscriptions_holding.op IS 'The operation on the node';
> COMMENT ON COLUMN subscriptions_holding.uid IS 'The person performing the operation';

Those are also good, if you really want comments.

irc: #debian.pl
Mors Drosophilis melanogastribus!

More information about the development mailing list