On Mon, Feb 16, 2009 at 03:21:20PM +0700, hendra kusuma wrote: > select right(column, number_of_character) from table [..] > honestly I have no idea that such simple feature doesn't exist in postgresql > or am I wrong? since I look at SQL Key Words table and it's written as > reserved AFAIK, it's reserved because "right" is used in outer join syntax; i.e. table RIGHT OUTER JOIN table, and not because of the function name. If you want this in Postgres, you could always do: CREATE FUNCTION right(TEXT,INTEGER) RETURNS TEXT LANGUAGE sql IMMUTABLE STRICT AS $$ SELECT substring($1 FROM char_length($1)-$2+1) $$; Using "right" to extract the right most characters from a string sounds very much like BASIC to me but may have moved to other languages now. Humm, lets have a look; BASIC has Right$(), Pascal has RightStr(), MySql has Right(), MS Sql Server has Right(). The other languages I chose to look at (C, C++, Java, PHP, Lua, Ruby, Javascript) all naively expose a substring function, like PG and Oracle, and leave anything like Right() up to the user. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general