[GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread sachin kotwal
While migrating my application from DB2 to PostgreSQL. I want to migrate TIMESTAMP() function of DB2 into PostgreSQL. Example in DB2: #SELECT TIMESTAMP('2013-01-01','12:13:14') FROM SYSIBM.SYSDUMMY1 1 -- 2013-01-01-12.13.14.00 1 record(s)

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread sachin kotwal
I have done some more try as follows: #select timestamp(current_date); ERROR: syntax error at or near current_date at character 18 STATEMENT: select timestamp(current_date); ERROR: syntax error at or near current_date LINE 1: select timestamp(current_date);

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread Raymond O'Donnell
On 27/06/2013 12:51, sachin kotwal wrote: I have done some more try as follows: #select timestamp(current_date); ERROR: syntax error at or near current_date at character 18 STATEMENT: select timestamp(current_date); ERROR: syntax error at or near current_date LINE 1: select

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread Daniel Cristian Cruz
I've done something weird: CREATE OR REPLACE FUNCTION timestamp(_date date, _time time) RETURNS timestamp AS $$ SELECT _date + _time; $$ LANGUAGE sql; SELECT timestamp('2013-01-01'::date, '12:00:00'::time); It worked, but you will need explict cast and quote the timestamp function name... Many

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread Suzuki Hironobu
On 2013-06-27 20:43, sachin kotwal wrote: While migrating my application from DB2 to PostgreSQL. I want to migrate TIMESTAMP() function of DB2 into PostgreSQL. Example in DB2: #SELECT TIMESTAMP('2013-01-01','12:13:14') FROM SYSIBM.SYSDUMMY1 1 --

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread John R Pierce
On 6/27/2013 4:51 AM, sachin kotwal wrote: #select timestamp(current_date); try... current_date::timestamptz orcast current_date as timestamptz -- john r pierce 37N 122W somewhere on the middle of the left coast -- Sent via pgsql-general

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread sachin kotwal
Using your link http://www.postgresql.org/docs/9.2/static/functions-formatting.html In DB2 when I use following command I am getting output combined date and time i passed to function. #SELECT TIMESTAMP('2013-01-01','12:13:14') FROM SYSIBM.SYSDUMMY1 1

Re: [GENERAL] Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

2013-06-27 Thread sachin kotwal
I've done something weird: CREATE OR REPLACE FUNCTION timestamp(_date date, _time time) RETURNS timestamp AS $$ SELECT _date + _time; $$ LANGUAGE sql; SELECT timestamp('2013-01-01'::date, '12:00:00'::time); Good one. function with above definition is already present in pg_catalog. so no need

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-21 Thread sachin kotwal
as i know each value is limited to 1GB. For larger content use module lo http://www.postgresql.org/docs/9.2/static/lo.html I just want to know that like DB2 we can convert other data types into CLOB/BLOB using function CLOB()/BLOB(). Example: SELECT CLOB('testdata') FROM SYSIBM.SYSDUMMY1 Same

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-21 Thread Amit Langote
On Fri, Jun 21, 2013 at 9:40 PM, sachin kotwal kotsac...@gmail.com wrote: as i know each value is limited to 1GB. For larger content use module lo http://www.postgresql.org/docs/9.2/static/lo.html I just want to know that like DB2 we can convert other data types into CLOB/BLOB using function

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-21 Thread Daniel de Oliveira Mantovani
http://wiki.postgresql.org/images/d/d1/DB2UDB-to-PG.pdf On 18 June 2013 05:52, sachin kotwal kotsac...@gmail.com wrote: Function in DB2: BLOB() Criteria: Size of character string targeted for cast is more than 1GB How can I migrate this function into PostgreSQL with above mention criteria.

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-21 Thread Joshua D. Drake
On 06/21/2013 04:49 PM, Daniel de Oliveira Mantovani wrote: http://wiki.postgresql.org/images/d/d1/DB2UDB-to-PG.pdf On 18 June 2013 05:52, sachin kotwal kotsac...@gmail.com wrote: Function in DB2: BLOB() Criteria: Size of character string targeted for cast is more than 1GB How can I migrate

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-20 Thread sachin kotwal
PostgreSQL has no such capability. Unless you need that and want to code it yourself, the best solution would be to write a function that just ignores the third argument. For time being I will write a function that just ignores the third argument. but if we really want to create such

[GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread sachin kotwal
While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. Functions in DB2: BLOB()/CLOB() Criteria: Size of character string targeted for cast is more than 1GB. Character String as argument to this function. How can I migrate this function

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Thomas Markus
Am 19.06.2013 08:05, schrieb sachin kotwal: While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. Functions in DB2: BLOB()/CLOB() Criteria: Size of character string targeted for cast is more than 1GB. Character String as argument to this

[GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread sachin kotwal
While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. TO_CHAR() in DB2 which can take three arguments as follows: SELECT TO_CHAR(CURRENT_DATE,'-MM-DD',112.50) FROM SYSIBM.SYSDUMMY1 I am not sure what is the purpose of third argument in

[GENERAL] Migration from DB2 to PostgreSQL-ROLLUP()

2013-06-19 Thread sachin kotwal
While migrating my application from DB2 to PostgreSQL. I want to migrate ROLLUP() function in PostgreSQL. Example: SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY_WEEK, SUM(SALES) AS UNITS_SOLD FROM SALES GROUP BY ROLLUP ( WEEK(SALES_DATE),

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Albe Laurenz
sachin kotwal wrote: While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. TO_CHAR() in DB2 which can take three arguments as follows: SELECT TO_CHAR(CURRENT_DATE,'-MM-DD',112.50) FROM SYSIBM.SYSDUMMY1 I am not sure what is the

Re: [GENERAL] Migration from DB2 to PostgreSQL-ROLLUP()

2013-06-19 Thread Pavel Stehule
Hello 2013/6/19 sachin kotwal kotsac...@gmail.com: While migrating my application from DB2 to PostgreSQL. I want to migrate ROLLUP() function in PostgreSQL. Example: SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY_WEEK, SUM(SALES) AS UNITS_SOLD FROM

Re: [GENERAL] Migration from DB2 to PostgreSQL-ROLLUP()

2013-06-19 Thread Merlin Moncure
On Wed, Jun 19, 2013 at 3:56 AM, sachin kotwal kotsac...@gmail.com wrote: While migrating my application from DB2 to PostgreSQL. I want to migrate ROLLUP() function in PostgreSQL. Example: SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY_WEEK, SUM(SALES) AS

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Amit Langote
On Wed, Jun 19, 2013 at 6:00 PM, Albe Laurenz laurenz.a...@wien.gv.at wrote: sachin kotwal wrote: While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. TO_CHAR() in DB2 which can take three arguments as follows: SELECT

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:10 AM, Amit Langote amitlangot...@gmail.com wrote: If this particular function is to be used repeatedly in a single query, would the cost of having a wrapper function around the original function be too large? For example, if this function appears in a WHERE clause

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Amit Langote
Hi, On Thu, Jun 20, 2013 at 10:27 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Jun 20, 2013 at 11:10 AM, Amit Langote amitlangot...@gmail.com wrote: If this particular function is to be used repeatedly in a single query, would the cost of having a wrapper function around the original

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:35 AM, Amit Langote amitlangot...@gmail.com wrote: On Thu, Jun 20, 2013 at 10:27 AM, Chris Angelico ros...@gmail.com wrote: If your wrapper function is written in SQL and is trivial (eg ignore the third parameter and pass the other two on), the planner should be able

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Amit Langote
On Thu, Jun 20, 2013 at 10:54 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Jun 20, 2013 at 11:35 AM, Amit Langote amitlangot...@gmail.com wrote: On Thu, Jun 20, 2013 at 10:27 AM, Chris Angelico ros...@gmail.com wrote: If your wrapper function is written in SQL and is trivial (eg ignore

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote amitlangot...@gmail.com wrote: Umm, my bad! I almost forgot I could write pure SQL function bodies. Although, why does following happen? (sorry, a 8.4.2 installation) : postgres=# create or replace function gt(n int, m int) returns boolean as

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Amit Langote
On Thu, Jun 20, 2013 at 11:10 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote amitlangot...@gmail.com wrote: Umm, my bad! I almost forgot I could write pure SQL function bodies. Although, why does following happen? (sorry, a 8.4.2 installation) :

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 12:34 PM, Amit Langote amitlangot...@gmail.com wrote: On Thu, Jun 20, 2013 at 11:10 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote amitlangot...@gmail.com wrote: Umm, my bad! I almost forgot I could write pure SQL function

[GENERAL] Migration from DB2 to PostgreSQL

2013-06-18 Thread sachin kotwal
Function in DB2: BLOB()Criteria:Size of character string targeted for cast is more than 1GBHow can I migrate this function into PostgreSQL with above mention criteria. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Migration-from-DB2-to-PostgreSQL-tp5759607.html Sent