Re: Reserved words and delimited identifiers

From: Joe Abbate <jma(at)freedomcircle(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reserved words and delimited identifiers
Date: 2011-11-30 17:36:27
Message-ID: 4ED6699B.4020105@freedomcircle.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/30/2011 11:26 AM, Kevin Grittner wrote:
> You are prepared to handle the difference between char and "char", I
> hope.

We have not implemented a type "verifier" in Pyrseas. It currently
generates SQL based on the type given in the input. In normal usage,
dbtoyaml is expected to be invoked first, and it will generate quoted
types if necessary, e.g.,

schema public:
description: standard public schema
table myuser:
columns:
- info:
type: '"user"'
- active:
type: '"char"'
- logons:
type: integer
type user:
attributes:
- name: text
- pass: text

The quotes above are because it selects format_type(atttypid, atttypmod)
from pg_attribute. The YAML output can then be fed into yamltodb and
will generate (assuming the "user" type and the first column of myuser
already exist):

ALTER TABLE myuser
ADD COLUMN active "char";
ALTER TABLE myuser
ADD COLUMN logons integer;

In other words, Pyrseas depends on the ultimate type verifier: the
PostgreSQL parser (and related routines).

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-11-30 18:08:44 Re: Why so few built-in range types?
Previous Message Tom Lane 2011-11-30 17:29:47 Re: Large number of open(2) calls with bulk INSERT into empty table