Subject: attribute name lengths...

From: Nat Howard <[email-masked]>
Date: Thu, 29 Apr 93 12:44:08 -0400

The shell script at the bottom of this message appears to 
break postgres -- the final "retrieve" gets an error.  

If you change this line:

        current_contacts=bytea

to 
        rent_contacts=bytea

it works.  (You may have to restart postmaster -- there's evidently
some difficulty about destroying and remaking classes).

Here's the ascii version:

#! /bin/sh
destroydb test_db
createdb test_db
monitor -TN test_db <<EOF

/* these match the things in canon.ticket */
create tt_ticket (		/* create the trouble-ticket class */
	ticket_number=int4,		/* unique ticket number */
	ticket_status=char16,	/* open, closed, hold_customer, hold_vendor, hold_us */
	current_contacts=bytea
)

\\g

/* Now create the ticket number */

create tt_number ( tt_number= int4 )  \\g
append tt_number (tt_number = 1) \\g
EOF

monitor -TN test_db <<EOF

begin replace tt_number (tt_number = tt_number.tt_number + 1 )

                 append tt_ticket (ticket_number = tt_number.tt_number, 
ticket_status = "open"

)

end
\\g
  
EOF

monitor -TN test_db <<EOF
retrieve(tt_ticket.all)\g
EOF

There error message you get is:

...
Go 
* 
Query sent to backend is "retrieve(tt_ticket.all)"
Error: Unexpected identfier in dump_data:

Here's the uuencoded version, so various backslashes survive:

Any hints?  Any help?  Thanks!

---

From: George Hartzell <[email-masked]>
Date: Thu, 29 Apr 93 14:11:53 -0700

>some difficulty about destroying and remaking classes).

There error you're seeing comes from src/libpq/fe-dumpdata.c, when it
see's an id that it doesn't recognize.  The comment there is:
                /* This should never happen. */

Postgres stores attribute names as type char16.  Internally
(src/backend/executor/ex_utils.c, ExecSetTypeInfo), postgres does a
strncpy with an n of 16.  Soooo, I suspect that somewhere else it is
taking your 16 character attribute name and making the last character
a null.  Alternatively, maybe it's not, in which case there's no null
on the end of the string, which could be equally bad.

It seems to me that you'd be safe if you limit yourself to 15
character attribute names.

There's probably a better fix, but...

g.

---

From: [email-masked] (Jeffrey Goh)
Date: Fri, 30 Apr 1993 09:55:22 +0800

I haven't touched it in a while, but isn't "current" a reserved
word (used by rules system).

- jeff