[SQL] ALTER TYPE my_enum AS ENUM ADD ('label10')

2010-03-22 Thread Andreas Gaab
Hi all, I start working with enumerator types and I am wondering, if my enumerator can later be adjusted. E.g. if I would like to add another label. Is it allowed just to add another entry to pg_enum? How is the enumerator then sorted (i.e. enum_last() )? Is it possible to alter the labels of

Re: [SQL] ALTER TYPE my_enum AS ENUM ADD ('label10')

2010-03-22 Thread A. Kretschmer
In response to Andreas Gaab : Hi all, I start working with enumerator types and I am wondering, if my enumerator can later be adjusted. E.g. if I would like to add another label. AFAIK you can't. Each enum is a own type. Use a lookup-table instead and use enum's only for real static

Re: [SQL] Emacs sql-postgres (please, sorry for question not about PostgreSQL).

2010-03-22 Thread Hiltibidal, Rob
I recommend switching to aqua data studio I can query mysql, postgres, db2, oracle with the same tool From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Dmitriy Igrishin Sent: Thursday, March 18, 2010 4:44 PM To: postgres list Subject: [SQL]

[SQL] string functions and operators

2010-03-22 Thread Neil Stlyz
Hello, I have a dilema and I was hoping someone here may offer guidance or assistance. I bet this is a very simple question for someone out there but I am having problems coming up with a solution. Here it is... suppose I have a field with the following values: 77.1 77.2 134.1 134.2 134.3

Re: [SQL] string functions and operators

2010-03-22 Thread Petru Ghita
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 That field of yours... what type is it? Is it TEXT? is it a numeric type? If it's TEXT, why don't you make it say... NUMERIC(/10/, /6///)? http://www.postgresql.org/docs/8.4/interactive/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL On 23/03/2010

Re: [SQL] string functions and operators

2010-03-22 Thread Petru Ghita
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 For numeric data types use: http://www.postgresql.org/docs/8.4/static/functions-math.html You could then use|floor|(dp or numeric)|| for example: postgres=# select floor(71.912); floor - --- 71 (1 row) postgres=# select

Re: [SQL] string functions and operators

2010-03-22 Thread Neil Stlyz
This is good, however, I need only the numbers to the right of the decimal point so if my number if 17.2 I would need one query that would return 17   (your function will do that) and the second query would return:   2 not 0.2 just 2 Does that make sense?

Re: [SQL] string functions and operators

2010-03-22 Thread Petru Ghita
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 select 0.341*pow(10,length(0.341::text)-2); 2 is a constat that stands for the '0.' part of the string representing the decimal part of the number. Petru Ghita On 23/03/2010 3:16, Neil Stlyz wrote: This is good, however, I need only the numbers

Re: [SQL] string functions and operators

2010-03-22 Thread Petru Ghita
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 For the record if you'd like to use regexp: select substring('201.123' from $$[0-9]*$$); and select substring('201.1232' from $$\.([0-9]*)$$); On 23/03/2010 4:42, Petru Ghita wrote: select 0.341*pow(10,length(0.341::text)-2); 2 is a constat