configure datatype name > 31?
configure datatype name > 31?
От:
"Mark McEahern" <marklists@mceahern.com>
Дата:
Is there a way to configure PostgreSQL to make the name field larger? The name datatype, which is used for these two columns in these system tables: pg_database.datname pg_shadow.usename is a 31 character field. That seems awfully low. For instance, what if I'm silly enough to want to make a database named: customer_GUID where GUID is something like: 0ff7d0cc-7394-4b15-a28e-7018b1056f9c You can imagine I have many customers, each with their own database; since I use a guid to distinguish the customers, it makes most sense to me to use a guid to distinguish their databases. Since GUIDs (in that form at least) are 36 characters, I'm already SOL. I can condense the data, but I'd really much rather just use it like it is. SQL Server 2000, for example, uses nvarchar(256) for the sysname field, which seems to perform a similar function. Thanks, // mark
Re: configure datatype name > 31?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Mark McEahern" writes: > Is there a way to configure PostgreSQL to make the name field larger? Edit src/include/postgres_ext.h to change NAMEDATALEN (keep it a multiple of 4). Build, install, initdb. In current releases there are client-side dependencies on NAMEDATALEN, so you should take care to recompile *everything*. We are working to remove all dependencies on NAMEDATALEN in the standard clients and client libraries for 7.3, though. According to recent tests there's a measurable performance hit for large values of NAMEDATALEN, so I wouldn't recommend making it bigger than about 100 ... regards, tom lane