[SQL] many-many mapping between unique tables

2000-10-15 Thread Indraneel Majumdar
Hi, I am facing a problem in mapping between two tables containing unique entries T1 T2 _ | x1 | | y1 | | x2 | | y2 | | x3 | | y3 | - - x(i) points to 1 or more entries in T2. y(i) points to one or mor

Re: [SQL] Variable-length Types

2000-10-15 Thread Bruce Momjian
> KuroiNeko, > > > I remember from the old days of Delphi/InterBase, and even older days of > > Paradox, there were so called input masks, US phone code mask would be like > > Input masks still exist for some languages (VB, Paradox) but I've found > that even in those platforms that support t

Re: [SQL] Variable-length Types

2000-10-15 Thread Josh Berkus
Mr. Popkov, > http://www.primechoice.com/hum/uspn.c Thanks! Since I don't read C, I'll just have to compile it as a function and try it out. To repay you, I'll write the function (in PL/PGSQL) to strip out any extraneous characters that the user might have added in data entry.

Re: [SQL] Variable-length Types

2000-10-15 Thread Josh Berkus
KuroiNeko, > I remember from the old days of Delphi/InterBase, and even older days of > Paradox, there were so called input masks, US phone code mask would be like Input masks still exist for some languages (VB, Paradox) but I've found that even in those platforms that support them I tend to

Re: [SQL] Variable-length Types

2000-10-15 Thread KuroiNeko
Josh, > Thanks. You're probably right ... reformatting the phone numbers is > going to be a lot less work than a custom type. I remember from the old days of Delphi/InterBase, and even older days of Paradox, there were so called input masks, US phone code mask would be like (999)_000-00-00

Re: [SQL] Variable-length Types

2000-10-15 Thread Itai Zukerman
> > 3. What sort of trouble am I going to get into trying to pull data from > > a custom type into an external interface (i.e. PHP4)? > > Good question --- the interface code might or might not have a sensible > default behavior for types it doesn't recognize. Why not explicitly convert to tex

Re: [SQL] Variable-length Types

2000-10-15 Thread Josh Berkus
Tom, > However, building a new type for this seems like overkill, because you'd > also have to supply a set of functions and operators for the type. It > would be a lot less work just to provide a normalization function > interpret_phone_no(text) returns text > which could be invoked exp

Re: [SQL] Variable-length Types

2000-10-15 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > I'm a bit confused on custom type declarations, actually. I'd like to > create a custom type for American phone numbers, such that: > ... > 1. Can I reference a custom function (phoneformat) in a type definition? Of course. The input and output c

Re: [SQL] Regular expression query

2000-10-15 Thread Bruce Momjian
> Rodger Donaldson <[EMAIL PROTECTED]> writes: > > SELECT url > > FROM sites > > WHERE url ~ url || '\\s+' > > > While this concatenation works with the LIKE directive (ie LIKE url || '%'), > > postgresql barfs on it in a regexp with the error: > > > ERROR: Unable to identify an operator '||'

Re: [SQL] Variable-length Types

2000-10-15 Thread Josh Berkus
Folks, I'm a bit confused on custom type declarations, actually. I'd like to create a custom type for American phone numbers, such that: It takes a string and returns something that looks like Varchar(22); If someone types in 10 digits, it returns output like (###) ###- If a user en

[SQL] Variable-length Types

2000-10-15 Thread Itai Zukerman
I'm going from the documentation in the Programmer's Guide, chapter 4. I'd like to have the following type available in Postegres: typedef struct FullName { char *first; char *last; } FullName; According to the docs, it looks like I need to do something like: typedef struct FullName { in