[Tfug] PostgreSQL/SQL

Bexley Hall bexley401 at yahoo.com
Sat Feb 21 08:37:42 MST 2009


Hi,

PostgreSQL (8.3) and I are presently engaged in mortal combat.
The enemy refuses to yield to my persistent attacks!  :<

CREATE TYPE mytype AS (
  a  point,
  b  point,
  c  text,
  d  text,
  e  integer
);

ALTER TABLE "MySchema"."MyTable" ADD COLUMN "MyTypes" mytype[];

I'm trying to poke a sample value into this table using the
Edit Data pane in pgAdmin III (1.8.4) -- I'll worry about
fully populating the array later (i.e., learn to crawl before
trying to walk).  Comma is the separator registered for each
of the above basic data types (whitespace added for clarity):

  (1,1), (1,2), "How now", "der hunt ging nach hause", 4

The composite type has to be enclosed in parens:

  ( (1,1), (1,2), "How now", "der hunt ging nach hause", 4 )

And, arrays must be enclosed in braces:

  { ( (1,1), (1,2), "How now", "der hunt ging nach hause", 4 ) }

But, the Edit Data pane complains that this is a "Malformed array
literal".

(sigh)

I'm obviously missing something.  :<

Perhaps I should fall back and manually "INSERT INTO ... VALUES ..."
in case the Edit Data pane is imposing different syntax restrictions?

Also, which system table(s) store the definition of my composite
type (so I can verify its definition)?

Thx,
--don


      



More information about the tfug mailing list