Re: [SQL] get_next_billing_date() ...

2006-10-20 Thread Marc G. Fournier



--On Monday, October 16, 2006 09:53:56 -0400 Tom Lane <[EMAIL PROTECTED]> wrote:


"Marc G. Fournier" <[EMAIL PROTECTED]> writes:

In fact, more info to work with ... it likes the date, just not when I use it
as part of a SELECT query of a table ...


I suspect it's not so much the "table" part as some specific value of
the date coming from the table --- can you find out what value it's
failing on?


That's the thing ... the one example I sent only returns one record, and if I 
plug in the timestamp value that it returns directly, it doesn't fail ...


Got it, and the error message in no way indicates ...

I created the function 'timestamp with time zone' ... the field in the table is 
'timestamp without time zone' ... fix the function , and voila:


company_id |   get_next_billing_date
+
   708 | 2006-12-13 14:09:11.442111
   679 | 2006-10-25 11:04:00.117714
   771 | 2006-11-03 15:09:19.491958
   688 | 2006-11-11 18:18:42.23105
   701 | 2006-11-28 11:45:36.182217
   656 | 2006-11-05 20:46:01.335434
   703 | 2006-11-28 19:35:25.081577
   704 | 2006-12-05 21:53:57.122358
   756 | 2007-01-02 14:18:22.11068

I knew it had to be *somethign* stupid :(

Thx ...


Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email . [EMAIL PROTECTED]  MSN . [EMAIL PROTECTED]
Yahoo . yscrappy   Skype: hub.orgICQ . 7615664


pgpx724ev1rmQ.pgp
Description: PGP signature


[SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Kenneth Gonsalves

hi,

am migrating a database from MSSQL to postgres. How would i migrate  
this:


[Id] [numeric](18, 0) IDENTITY (1, 1)

--
regards

Kenneth Gonsalves
Associate, NRC-FOSS
[EMAIL PROTECTED]
http://nrcfosshelpline.in/web/




---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [SQL] [HACKERS] Bug?

2006-10-20 Thread Indira Muthuswamy
Then how do we clear the values of a serial column(is it done only by dropping the column?)?
 
Regards,
M.Indira 
On 10/19/06, Jim C. Nasby <[EMAIL PROTECTED]> wrote:
Moving to -sql.On Wed, Oct 18, 2006 at 06:53:46PM +0530, Indira Muthuswamy wrote:> Hai,
>> I have encountered a problem with PostgreSQL.I have created a table> 'tab1' with a column 'a' with serial type.I entered 20 records into the> table.So the query>  select max(a) from tab1;
> returned 20.When I tried the same query after the command> truncate table tab1;> I found that the output of the first query as>> max> ->> (1 row)> When I tried to insert a new row into the table tab1 I found that the
> value at column a incremented to the value 21.> But I heard from my friends that the value of the serial column gets> decremented whenever we issue the 'truncate table' command (in MS SQL> SERVER).Is the concept same with PostgreSQL or not?Can anyone clarify me on
> this?Your friends are mistaken. TRUNCATE does nothing to affect sequences.--Jim Nasby[EMAIL PROTECTED]EnterpriseDB  
http://enterprisedb.com  512.569.9461 (cell)


[SQL] PostgreSQL 8.1.5 Documentation - Chapter 32. Extending SQL

2006-10-20 Thread Rares Vernica

Hi,

I tried the code from "Calling Conventions Version 1 for C-Language 
Functions"


I had to add this in order to make it compile:
/* 16-byte structure, passed by reference */
typedef struct
{
   double  x, y;
} Point;

Anyway, the "Point" is still giving me hard time:
psql:foo.sql:3: ERROR:  could not load library "...foo.so": ld.so.1: 
postgres: fatal: relocation error: file ...foo.so: symbol 
PG_GETARG_POINT_P: referenced symbol not found


Thanks a lot,
Ray


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Daniel CAUNE
> De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> De la part de Kenneth Gonsalves
> Envoyé : 15 octobre 2006 08:31
> À : pgsql-sql@postgresql.org
> Objet : [SQL] conversion of numeric field from MSSQL to postgres
> 
> hi,
> 
> am migrating a database from MSSQL to postgres. How would i migrate
> this:
> 
> [Id] [numeric](18, 0) IDENTITY (1, 1)
> 

It seems that you've already asked for this question last Sunday, and
because your question is somewhat deterministic, the answers are more likely
to be the same.  Check your previous e-mails.

--
Daniel


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Richard Broersma Jr
> It seems that you've already asked for this question last Sunday, and
> because your question is somewhat deterministic, the answers are more likely
> to be the same.  Check your previous e-mails.

actually I am get duplicate emails like this one across the various PG lists.  
Perhaps someone
else is resending these email?

Regards,

Richard Broersma Jr.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] [NOVICE] How to split a table?

2006-10-20 Thread Christoph Frick
On Tue, Oct 17, 2006 at 03:39:21PM +0800, Felix Zhang wrote:

> I want to split a table to 2 small tables. The 1st one contains 60%
> records which are randomly selected from the source table.  How to do
> it?

i do my A/B-Group splitting usually by &1 the serial of the table.
assuming, that there are no irregularities in the process of creating
your entries, this should give a 50/50 split, which is reuseable for
future things and there never is a intersection of the two groups.

-- 
cu


pgpcM3nN8BY41.pgp
Description: PGP signature


[SQL] Can we convert from Postgres to Oracle !!???

2006-10-20 Thread Sandeep Kumar Jakkaraju

Can we convert from Postgres to Oracle !!???

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [SQL] [NOVICE] How to split a table?

2006-10-20 Thread Obe, Regina



I would do
 
select * into mynewtable 
from myoldtable ORDER by random() LIMIT 15000
 
where 15000 in this case is *.6
 
If you want to create another table with 40% of the 
remaining data then something like
 
select * into mynewtable2 from myoldtable where 
myoldtable.primarykey NOT IN(select primarykey from 
mynewtable)
]
In this case primarykey you would replace with the 
primary key field of your table.


From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Felix 
ZhangSent: Tuesday, October 17, 2006 3:39 AMTo: 
pgsql-sql@postgresql.org; pgsql-general@postgresql.org; 
[EMAIL PROTECTED]Subject: [NOVICE] How to split a 
table?

Hi,
 
I want to split a table to 2 small tables. The 1st one contains 60% records 
which are randomly selected from the source table.
How to do it?
 
Regards,
Felix




The substance of this message, including any attachments, may be
confidential, legally
privileged and/or exempt from disclosure pursuant to Massachusetts
law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and
delete the material from any computer.



Re: [SQL] PostgreSQL 8.1.5 Documentation - Chapter 32. Extending SQL

2006-10-20 Thread Michael Fuhr
On Thu, Oct 19, 2006 at 08:14:26PM -0700, Rares Vernica wrote:
> I tried the code from "Calling Conventions Version 1 for C-Language 
> Functions"
> 
> I had to add this in order to make it compile:
> /* 16-byte structure, passed by reference */
> typedef struct
> {
>double  x, y;
> } Point;
> 
> Anyway, the "Point" is still giving me hard time:
> psql:foo.sql:3: ERROR:  could not load library "...foo.so": ld.so.1: 
> postgres: fatal: relocation error: file ...foo.so: symbol 
> PG_GETARG_POINT_P: referenced symbol not found

Try including utils/geo_decls.h -- that should define both the
structure and the macro you're missing.

-- 
Michael Fuhr

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Tom Lane
Richard Broersma Jr <[EMAIL PROTECTED]> writes:
> actually I am get duplicate emails like this one across the various PG lists. 
>  Perhaps someone
> else is resending these email?

The usual mechanism is

* newbie sends question
* newbie gets response indicating that message is being held for
  moderator approval because he's not subscribed
* newbie subscribes and reposts question, which people answer
* eventually, list moderator cleans out the queue and approves the
  original question

It's not really a duplicate, but it looks like one.

This could be fixed if someone wanted to improve the moderation software
to auto-approve pending messages from someone who's just subscribed, but
perhaps that's a lot of work.  I haven't looked at that code, so I'm not
volunteering ...

regards, tom lane

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Richard Broersma Jr
> This could be fixed if someone wanted to improve the moderation software
> to auto-approve pending messages from someone who's just subscribed, but
> perhaps that's a lot of work.  I haven't looked at that code, so I'm not
> volunteering ...

Thats not a problem.  I was surprised to see your name in a man pages for other 
command line
utilities un-related to postgresql.  So I would expect that you have enough to 
do in the mean time
besides altering the moderation software. :-)

Regards,

Richard Broersma Jr.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings