Re: [SQL] Recursive pl/pgsql function ...

2006-10-15 Thread Marc G. Fournier
--On Sunday, October 15, 2006 23:27:34 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: "Marc G. Fournier" <[EMAIL PROTECTED]> writes: More then one Record: # select get_next_billing_date(activated, 12) from company_details; ERROR: control reached end of function without RETURN CONTEXT: PL/pgSQL f

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-15 Thread Tom Lane
chrisj <[EMAIL PROTECTED]> writes: > Did not seem to help: > ERROR: invalid input syntax for type timestamp with time zone: "2006-07-13 > 09:20:00 America/New_York" Sorry, I was thinking in terms of CVS HEAD ... the ability to use a full timezone spec in timestamptz input is new for 8.2. You mig

Re: [SQL] Recursive pl/pgsql function ...

2006-10-15 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > More then one Record: > # select get_next_billing_date(activated, 12) from company_details; > ERROR: control reached end of function without RETURN > CONTEXT: PL/pgSQL function "get_next_billing_date" Hm, what PG version is this? I couldn't dupli

[SQL] Recursive pl/pgsql function ...

2006-10-15 Thread Marc G. Fournier
'k, this isn't quite working as expected (or, rather, hoped) ... I've created a recursive function (that does work nicely) that takes a date in the past, and keeps advancing in steps of 'n months' until the date is in the future: CREATE OR REPLACE FUNCTION get_next_billing_date(timestamp with

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-15 Thread chrisj
Did not seem to help: protocal2=> select start_datetime,cast(cast(cast(start_datetime as timestamp(0) without time zone) as varchar)||' '||B.timezone_ch as timestamp(0) with time zone) from reservation A, location B where appt_key = 7 and locn_key = 102 ; ERROR: invalid input syntax for type ti

Re: [SQL] Temp tables, reports in Postgresql (and other RDBMS)

2006-10-15 Thread ow
--- Tom Lane <[EMAIL PROTECTED]> wrote: > If you need some procedural logic (if-then-else stuff) Yes > then you'd need > to go over to plpgsql, which would be a bit of a pain because its habit > of caching query plans doesn't play nice with temp tables. Going to plpgsql is fine. What I'm tryin

Re: [SQL] Temp tables, reports in Postgresql (and other RDBMS)

2006-10-15 Thread Tom Lane
ow <[EMAIL PROTECTED]> writes: > We are considering moving some reports from *** to Postgres. Our reports are > written as stored procs in Transact-SQL and usually have the following > structure: > ... > How would one rewrite the above logic in Postgresql? If that's all you have to do, then SQL-la

[SQL] Temp tables, reports in Postgresql (and other RDBMS)

2006-10-15 Thread ow
Hi, We are considering moving some reports from *** to Postgres. Our reports are written as stored procs in Transact-SQL and usually have the following structure: CREATE PROCEDURE someReportProc AS /* Purpose: Creates a report based on Table1. * * Overview of what will be done: * 1) create a

Re: [SQL] migrating numeric to serial from MSSQL to postgres

2006-10-15 Thread Daniel CAUNE
> I believe: > IDENTITY(1, 1) just means "Primary Key" in M$SQL > IDENTITY is not obligatory a primary key. It's an auto-incremented column. It might correspond to a PostgreSQL sequence. [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts _ia-iz_3iex.asp] > numeric 18,

Re: [SQL] migrating numeric to serial from MSSQL to postgres

2006-10-15 Thread Daniel CAUNE
> hi, > > am migrating a database from MSSQL to postgres. How would i migrate > this: > > [Id] [numerc](18, 0) IDENTITY (1, 1) > You might want to create a sequence first, such as with more or less options: CREATE SEQUENCE my_sequence INCREMENT BY 1 MINVALUE 1 NO MAXVALUE START WITH 1

Re: [SQL] migrating numeric to serial from MSSQL to postgres

2006-10-15 Thread Terry Fielder
I believe: IDENTITY(1, 1) just means "Primary Key" in M$SQL numeric 18,0 means a numeric field of zero decimal points. Hence we are looking at a 18 byte integer. bigint is not big enough, so probably should use the same in numeric 18,0 in postgres There may be a way to get MSSQL to dump a S

[SQL] migrating numeric to serial from MSSQL to postgres

2006-10-15 Thread Kenneth Gonsalves
hi, am migrating a database from MSSQL to postgres. How would i migrate this: [Id] [numerc](18, 0) IDENTITY (1, 1) -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ ---(end of broadcast)--- TIP 9: In versions below