Re: [SQL] User defined types -- Social Security number...

2004-02-22 Thread Josh Berkus
Greg,

> Anyone have a good pre-built user-defined type definition for creating /
> maintaining / manipulating a SSN ... where valid chars are in the range
> 000-00- through 999-99-.

Actually, the range is more narrowly defined than that.  I'm not sure of the 
exact rules, but you will never see a leading 0 or a -00- in an SSN.

> I imagine that the storage column is probably varchar(11) -- I am looking
> for a type definition that

Use DOMAINs, not a custom type.  It's less work.

> Either that or the question is: How can I coerce postgreSQL into using an
> input / output "mask"...

After you've created your DOMAIN, based on the TEXT type, you can overload the 
input and output functions to format correctly.   Beware, though: input & 
output functions pretty much have to be written in C.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [SQL] Compiling pl/pgsql functions

2004-02-22 Thread Josh Berkus
Rod,

> This is another one of those items where it would be nice if users
> didn't need access to read the system tables, but instead could rely on
> the information schema (with extensions) to see what they own or have
> access to use -- but nothing else.

Hmmm, that is a good question: can I, as a database user, query the source 
code for functions I don't have permissions on?This seems like an easy 
adjustment to the system tables, if so.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] Postgres DB

2004-02-22 Thread Tom Lane
"Sumita Biswas" <[EMAIL PROTECTED]> writes:
> But when I type the command "psql" and don't specify a DB name, it says
> that:
> psql: FATAL:  Database "postgres" does not exist in the system catalog.

Yes, because psql's default behavior is to try to connect to the DB with
the same name as your user name.  That doesn't mean that such a DB is
guaranteed to exist, or even that anything is going to try to create it
for you.  It's just a default behavior that people have found handy.

regards, tom lane

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org