[SQL] FIND_IN_SET

2009-12-11 Thread Michael Eshom
I am on the marketing team for a popular forum system, and am also the primary PostgreSQL tester/bugfixer. Currently our forum system treats MySQL's FIND_IN_SET() as a boolean (eg whether or not the specified value was found in the given set), which is fine since MySQL will treat any integer gr

[SQL] Re: constants in 2-column foreign keys or how to design a storage for text-groups ?

2009-12-11 Thread Jasen Betts
On 2009-12-09, Andreas wrote: > Hi, ... > stupid example: > --- > color: red, green, blue > size: tiny, little, big, giant > structure: hard, soft, floppy > > How would I solve the rather common text storage issue? have you considered using enumerated types instead? -- Sent vi

Re: [SQL] FIND_IN_SET

2009-12-11 Thread Pavel Stehule
2009/12/11 Michael Eshom : > I am on the marketing team for a popular forum system, and am also the > primary PostgreSQL tester/bugfixer. Currently our forum system treats > MySQL's FIND_IN_SET() as a boolean (eg whether or not the specified value > was found in the given set), which is fine since

Re: [SQL] Re: constants in 2-column foreign keys or how to design a storage for text-groups ?

2009-12-11 Thread Andreas
Jasen Betts schrieb: On 2009-12-09, Andreas wrote: ... stupid example: --- color: red, green, blue size: tiny, little, big, giant structure: hard, soft, floppy How would I solve the rather common text storage issue? have you considered using enumerated types instead? Ye

Re: [SQL] Window function trouble

2009-12-11 Thread Harald Fuchs
In article <28855.1260486...@sss.pgh.pa.us>, Tom Lane writes: > Harald Fuchs writes: >> That being said, I still think that PostgreSQL could do better - how >> about naming expression columns so that they are distinct from column >> names? > Even though the rules we use are pretty arbitrary, I'

[SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Oliveiros C,
Dear All, I have a table with host names and some happen to be numeric IPs. I would like to be able to filter out the later. Is there any function pre-defined in the system that can test a particular text type value to see if it is a numeric ip? Something that returns true if applied to '192.1

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Fernando Hevia
> -Mensaje original- > De: de Oliveiros C, > > Dear All, > > I have a table with host names and some happen to be numeric IPs. > > I would like to be able to filter out the later. > > Is there any function pre-defined in the system that can test > a particular text type value to

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Harald Fuchs
In article , "Oliveiros C," writes: > Dear All, > I have a table with host names and some happen to be numeric IPs. > I would like to be able to filter out the later. > Is there any function pre-defined in the system that can test a particular > text > type value to see if it is a numeric ip

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Fernando Hevia
> > You could filter IP out with a regular expression: > > select hostname as hosts_not_ip > from table > where hostname !~ '^[0-9]\.[0-9]\.[0-9]\.[0-9]$' > Oops, i missed something. Its: select hostname as hosts_not_ip from table where hostname !~ '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Alvaro Herrera
Oliveiros C, wrote: > I've realized that, for ex, inet 'x.x.x.x' will fail if the input is not a > numeric IP, > is there any simple and direct way to somewhat trap that error and convert it > to a false value that can be used > in a WHERE clause? Yes, you can create a plpgsql function with an

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Oliveiros C,
Howdy, Alvaro, Fernando and Harald. Thanks a lot for your prompt reply. As I'm in a big hurry with this I used the regular expressions thing, it worked fine. But your solution looks good as well, Alvaro, the problem is my poor knowledge on pgplsql Definitely, I have to study in more depth