Re: [GENERAL] like operation in tsearch

2010-03-21 Thread Oleg Bartunov

We introduced prefix support in 8.4, so one may use:

=# select to_tsvector('Rumman went to iftekhar to solve it') @@ 
to_tsquery('ifte:*') as c;
 c 
---

 t
(1 row)


On Sun, 21 Mar 2010, AI Rumman wrote:


I am using Postgresql 8.1 tsearch2.

I need to match a like operation in tsearch. Such as,

Sample data:

Document
..

Rumman went to iftekhar to solve it.


select ...
from ...
where document like '%ifte%'

need to be written in tsearch. Here ifte is a name

But in tsearch when I am using to_tsvector, it gives as follows-

'iftekhar':4 'rumman':1 'solv':6 'went':2

postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte') as c;
c
---
f
(1 row)

I am confused how to execute the above like operation in tsearch.

Any help please.



Regards,
Oleg
_
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: o...@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to dump JUST procedures/funnctions?

2010-03-21 Thread Carlo Stonebanks

Is pg_get_functiondef an 8.4 appears to be an 8.4 function?

I don't see it in the 8.3 documentation and the servers in question are all 
8.3.


Any alternatives for 8.3? pg_proc has the code body, but not the function 
declaration, etc.




Andreas Kretschmer akretsch...@spamfence.net wrote in message 
news:20100320081646.ga26...@tux...

Carlo Stonebanks stonec.regis...@sympatico.ca wrote:


I'd like to dump to text the full SQL required to create/replace all
user-defined functions within a specific schema - but JUST the function
declarations.

We are doing server migration and there are some network paths in the
code I would like to search and replace.


All functions are stored in pg_catalog.pg_proc, you can search the
column prosrc for your network paths.

And you can get the whole function-definition with pg_get_functiondef.


Okay. Now you can run this select:

select 'select pg_get_functiondef (' || oid || ');' from pg_proc where 
prosrc ~ 'network path';


The result can you use to run as commands to retrieve all
function-definitions.


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.  (Linus Torvalds)
If I was god, I would recompile penguin with --enable-fly.   (unknown)
Kaufbach, Saxony, Germany, Europe.  N 51.05082°, E 13.56889°

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Wordpress-Mu with postgresql

2010-03-21 Thread AI Rumman
Does any one use Wordpress-Mu with Postgresql?

If yes, please tell me the way.


Re: [GENERAL] Wordpress-Mu with postgresql

2010-03-21 Thread Nilesh Govindarajan

On 03/21/2010 12:23 PM, AI Rumman wrote:

Does any one use Wordpress-Mu with Postgresql?
If yes, please tell me the way.


Wordpress doesn't support Postgresql as far as I know. Drupal supports 
Postgresql.


--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to dump JUST procedures/funnctions?

2010-03-21 Thread A. Kretschmer
In response to Carlo Stonebanks :
 Is pg_get_functiondef an 8.4 appears to be an 8.4 function?

Yes, new since 8.4.


 
 I don't see it in the 8.3 documentation and the servers in question are all 
 8.3.
 
 Any alternatives for 8.3? pg_proc has the code body, but not the function 
 declaration, etc.

Afaik no, you can make a schema-dump and extract the function
declarations from the dump.

Or, upgrade to 8.4 ;-)


Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Help me with this tricky join

2010-03-21 Thread A. Kretschmer
In response to Jay :
 Thanks!
 But, since the master can contain many users (user2, user3, and so on)
 I suppose this won't be a proper solution?
 Sorry if I was a bit unclear in my description.
 
 I.e., the master is of the form:
 
 user_id date
 User1 20010101
 User1 2101
 User1 19990101
 User1 19970101
 User2 ...
 ...

That's not the problem ...

 
 Btw, I'm using Postgre version 8.2 and I cannot use subqueries do the

but this.
lag() over () and similar windowing functions new since 8.4.



Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] like operation in tsearch

2010-03-21 Thread AI Rumman
Helo,

I am using Postgresql 8.1 and I found that to_tsquery('iftek:*) gives systax
error.

On Sun, Mar 21, 2010 at 12:11 PM, Oleg Bartunov o...@sai.msu.su wrote:

 We introduced prefix support in 8.4, so one may use:


 =# select to_tsvector('Rumman went to iftekhar to solve it') @@
 to_tsquery('ifte:*') as c;
  c ---
  t
 (1 row)



 On Sun, 21 Mar 2010, AI Rumman wrote:

 I am using Postgresql 8.1 tsearch2.

 I need to match a like operation in tsearch. Such as,

 Sample data:

 Document
 ..

 Rumman went to iftekhar to solve it.


 select ...
 from ...
 where document like '%ifte%'

 need to be written in tsearch. Here ifte is a name

 But in tsearch when I am using to_tsvector, it gives as follows-

 'iftekhar':4 'rumman':1 'solv':6 'went':2

 postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
 to_tsquery('ifte') as c;
 c
 ---
 f
 (1 row)

 I am confused how to execute the above like operation in tsearch.

 Any help please.


Regards,
Oleg
 _
 Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
 Sternberg Astronomical Institute, Moscow University, Russia
 Internet: o...@sai.msu.su, http://www.sai.msu.su/~megera/
 phone: +007(495)939-16-83, +007(495)939-23-83



Re: [GENERAL] like operation in tsearch

2010-03-21 Thread Pavel Stehule
2010/3/21 AI Rumman rumman...@gmail.com:
 Helo,

 I am using Postgresql 8.1 and I found that to_tsquery('iftek:*) gives systax
 error.


you have to upgrade to 8.4 when you would to use this feature

regards
Pavel Stehule

 On Sun, Mar 21, 2010 at 12:11 PM, Oleg Bartunov o...@sai.msu.su wrote:

 We introduced prefix support in 8.4, so one may use:

 =# select to_tsvector('Rumman went to iftekhar to solve it') @@
 to_tsquery('ifte:*') as c;
  c ---
  t
 (1 row)


 On Sun, 21 Mar 2010, AI Rumman wrote:

 I am using Postgresql 8.1 tsearch2.

 I need to match a like operation in tsearch. Such as,

 Sample data:

 Document
 ..

 Rumman went to iftekhar to solve it.


 select ...
 from ...
 where document like '%ifte%'

 need to be written in tsearch. Here ifte is a name

 But in tsearch when I am using to_tsvector, it gives as follows-

 'iftekhar':4 'rumman':1 'solv':6 'went':2

 postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
 to_tsquery('ifte') as c;
 c
 ---
 f
 (1 row)

 I am confused how to execute the above like operation in tsearch.

 Any help please.


        Regards,
                Oleg
 _
 Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
 Sternberg Astronomical Institute, Moscow University, Russia
 Internet: o...@sai.msu.su, http://www.sai.msu.su/~megera/
 phone: +007(495)939-16-83, +007(495)939-23-83



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] stopping processes, preventing connections

2010-03-21 Thread Craig Ringer

On 21/03/2010 7:12 AM, Scott Marlowe wrote:

On Sat, Mar 20, 2010 at 3:57 PM, Herouth Maozhero...@unicell.co.il  wrote:



The problem is not so much danger in upgrading, but the fact that doing so
without using the system's usual security/bugfix update path means
non-standard work for the sysadmin, meaning he has to upgrade every package
on the system using a different upgrade method, being notified about it from
a different source, and needing to check each one in different conditions,
which makes his work impossible. So the policy so far has been Use the
packages available through debian. So I'll need to check if there is an
upgrade available through that path - and the question is whether it's
worthwhile (i.e. whether the bug in question has indeed been fixed).


I'm certain debian keeps the pgsql packages up to date within a few
days or at most weeks of their release .


In sid (unstable), sure. But the stable releases don't usually see major 
version upgrades (like 8.3 to 8.4) unless they're done via unofficial 
channels like backports.org .


--
Craig Ringer

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Hans Samses

2010-03-21 Thread william wayne
http://wiaderko.110mb.com/mustapha.html
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/210850552/direct/01/

Re: [GENERAL] stopping processes, preventing connections

2010-03-21 Thread Scott Marlowe
On Sun, Mar 21, 2010 at 5:33 AM, Craig Ringer
cr...@postnewspapers.com.au wrote:
 On 21/03/2010 7:12 AM, Scott Marlowe wrote:

 On Sat, Mar 20, 2010 at 3:57 PM, Herouth Maozhero...@unicell.co.il
  wrote:


 The problem is not so much danger in upgrading, but the fact that doing
 so
 without using the system's usual security/bugfix update path means
 non-standard work for the sysadmin, meaning he has to upgrade every
 package
 on the system using a different upgrade method, being notified about it
 from
 a different source, and needing to check each one in different
 conditions,
 which makes his work impossible. So the policy so far has been Use the
 packages available through debian. So I'll need to check if there is an
 upgrade available through that path - and the question is whether it's
 worthwhile (i.e. whether the bug in question has indeed been fixed).

 I'm certain debian keeps the pgsql packages up to date within a few
 days or at most weeks of their release .

 In sid (unstable), sure. But the stable releases don't usually see major
 version upgrades (like 8.3 to 8.4) unless they're done via unofficial
 channels like backports.org .

It was a few posts back, but our discussion point was minor point
upgrades and the fact that OP was running 8.3.1 and not sure there
were updates to 8.3.9 (or latest) out there for debian.  I'm quite
sure debian has 8.3.9 out by now.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Restrict allowed database names?

2010-03-21 Thread Sergey Konoplev
On 21 March 2010 00:24, Adam Seering aseer...@mit.edu wrote:
 Hi,
        I'm trying to set up an internal general-purpose PostgreSQL server 
 installation.  I want most users with login access to the server to be able 
 to create databases, but only with names that follow a specified naming 
 convention (in particular, approximately is prefixed with the owner's 
 username).  A subset of administrative users can create users with any name. 
  The goal is to let users create arbitrary databases, but to force them to 
 get approval for names that someone else (or some other service) might 
 conceivably want.

        Is there any way to enforce this within PostgreSQL?  Maybe something 
 like a trigger on CREATE DATABASE, if that's possible?


What about PL/pgSQL wrapper function for CREATE DATABASE with database
name check and SECURITY DEFINER option. And of course you should not
set CREATEDB option to regular users.

-- 
Regards,
Sergey Konoplev

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Restrict allowed database names?

2010-03-21 Thread Daniel Verite
Sergey Konoplev wrote:

 What about PL/pgSQL wrapper function for CREATE DATABASE with database
 name check and SECURITY DEFINER option. 

Not possible because CREATE DATABASE can't be executed within a function (nor
within a transaction).

Best regards,
-- 
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Restrict allowed database names?

2010-03-21 Thread Sergey Konoplev
On 21 March 2010 20:43, Daniel Verite dan...@manitou-mail.org wrote:
        Sergey Konoplev wrote:

 What about PL/pgSQL wrapper function for CREATE DATABASE with database
 name check and SECURITY DEFINER option.

 Not possible because CREATE DATABASE can't be executed within a function (nor
 within a transaction).

Ah, exactly. Well than what if we use PL/Python or PL/Perl function
where we do connect to this postgres server and do CREATE DATABASE?
Looks very tricky but seems to be working.

-- 
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com / Linkedin:
http://ru.linkedin.com/in/grayhemp
JID/GTalk: gray...@gmail.com / Skype: gray-hemp / ICQ: 29353802

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Restrict allowed database names?

2010-03-21 Thread Tom Lane
Daniel Verite dan...@manitou-mail.org writes:
   Sergey Konoplev wrote:
 What about PL/pgSQL wrapper function for CREATE DATABASE with database
 name check and SECURITY DEFINER option. 

 Not possible because CREATE DATABASE can't be executed within a function (nor
 within a transaction).

Note that the reasons why that's true are equally good reasons to not
allow triggers or any other user-added operations for CREATE DATABASE.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Problems with CREATE CAST

2010-03-21 Thread John Shott

Postgresql Community:

We have an Java/JDBC application that runs against a range of versions 
of Postgresql from 7.4 though 8.3 and are now moving to 8.4.


Because our databases will never approach 4GB in size we still use OIDs 
... that is, in newer versions of Postgresql we create OIDs on all 
tables with:


SET default_with_oids = true;

In Postgresql 8.4, however, we are seeing the following error:

SQL error executing statement.
update status set some_column = 'some_value' where oid = 'some_string'
org.postgresql.util.PSQLException: ERROR: operator does not exist: oid = 
character varying
 Hint: No operator matches the given name and argument type(s). You 
might need to add explicit type casts.

 Position: 132

Because these SQL commands are generated on the fly by a Java 
application that opens a JDBC connection to our database, we would 
rather not use explicit casting and would prefer to add appropriate 
casts in our Postgresql 8.4 databases to match the behavior that we get 
in Postgresql 7.4/8.0/8.1/8.2/8.3 databases.


When I issue the command \dC and look for the casts that would convert 
an OID to character varying, in Postgresql 8.3 and earlier I find the cast:


Source type   Target type Function   Implicit?
oid character_varying   text   in assignment

This cast is missing in Postgresql 8.4.

So, I thought I could resolve this by creating the appropriate cast.  
After checking the documentation and running as the database user 
postgres, I thought that the following  CREATE CAST command would create 
the missing oid to character varying cast:


CREATE CAST (oid AS character varying) WITH FUNCTION text(oid) AS 
ASSIGNMENT;


However, this results in ERROR: function text(oid) does not exist.

Clearly, I must have misread or misunderstood the CREATE CAST syntax in 
my attempts to create a pre-Postgresql-8.4 cast from oid to character 
varying.  Does anyone with more experience using the CREATE CAST command 
see my problem?


Thanks for your consideration,

John




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Transaction table

2010-03-21 Thread Vick Khera
On Sat, Mar 20, 2010 at 4:47 AM, Deepa Thulasidasan
deepatulsida...@yahoo.co.in wrote:
 transaction table to grow by 10 times in near future. In this regard, we 
 would like to know if this same structure of the transaction table and the 
 indexing would be sufficient for quick retrivel of data  or do we have to 
 partition this table? If so what kind of partition would be suitable?


My experience has been that when the tables are approaching the 100
million record mark things tend to slow down.  Running reindex and
vacuum on those tables also takes much longer since you tend not to
have enough memory to do those operations efficiently.

I like to partition tables such that they end up having under 10
million records each.  I just (a few hours ago...) finished
partitioning and migrating the data from a single table that had about
120 million records into 100 partitions of about 1.2 million rows
each.  For this particular case, I just partitioned on a mod 100
operation of one of the ID keys on which I do the bulk of my searches.

Like the two Scott M's recommended, figure out your usage patterns and
partition across those vectors to optimize those searches.  I would
not worry about optimizing the insert pattern.

You really *never* delete this data?  I would suspect then that having
a partitioning scheme where the number of partitions can grow over
time is going to be important to you.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Problems with CREATE CAST

2010-03-21 Thread Tom Lane
John Shott sh...@stanford.edu writes:
 update status set some_column = 'some_value' where oid = 'some_string'
 org.postgresql.util.PSQLException: ERROR: operator does not exist: oid = 
 character varying

 Because these SQL commands are generated on the fly by a Java 
 application that opens a JDBC connection to our database, we would 
 rather not use explicit casting and would prefer to add appropriate 
 casts in our Postgresql 8.4 databases to match the behavior that we get 
 in Postgresql 7.4/8.0/8.1/8.2/8.3 databases.

I can assure you that that didn't work in 8.3 either.

You really need to fix your app to not be forcing these strings to
varchar.  Even in old versions, that code worked for only very small
values of work: it would have used textual rather than numeric
comparison, which isn't really the semantics you want and would have
had a huge performance cost (notably, the inability to use an index
on the oid column).

What you probably need to be doing is not using setString() to set the
parameter values, but you could get better advice about that on the
pgsql-jdbc list.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Transaction table

2010-03-21 Thread John R Pierce

Vick Khera wrote:

You really *never* delete this data?  I would suspect then that having
a partitioning scheme where the number of partitions can grow over
time is going to be important to you.
  


he said a new table is created each day, but nothing about these daily 
tables being partitions in a larger view.   I don't know if that means 
the old daily tables are deleted eventually or just kept forever.  he 
then said the daily table will be growing by 10X, I don't know if these 
means 10 times more vehicles or 10 times the number of daily trackpoints 
per vehicle.   he said this daily table has two indexes, I suspect these 
are vehicle number, and time of track point, but I'm just guessing.


if it is by vehicle and by time, and the number of vehicles is 
multiplying, he could partition by vehicle if the daily table becomes 
oto large, or he could partition by hour.   partitioning per vehicle 
would allow putting them in different tablespaces, which could be on 
different disk drives and spread the write load out across more 
spindles, while hourly would concentrate all the writes on the same 
sub-table.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Problems with CREATE CAST

2010-03-21 Thread John Shott

Tom Lane et al:

Thank you for your comments and observations.  In particular, you make 
me realize that I likely don't know how the JDBC connection is handling 
things. I find that I often tend to assume that what I see and use on 
the interactive command like is exactly what is coming across the wire 
on a JDBC connection.  In fact, you are exactly correct about the 
inability to use an index on the oid column.  We do have an index and 
yet have seen performance problems for a table that rarely exceeds a few 
hundred rows.


I'll take your advice and see what the JDBC folks suggest and see if we 
can handle things in a better fashion.


Thanks again,

John


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Transaction table

2010-03-21 Thread Scott Marlowe
On Sun, Mar 21, 2010 at 1:30 PM, Vick Khera vi...@khera.org wrote:
 Like the two Scott M's recommended, figure out your usage patterns and
 partition across those vectors to optimize those searches.  I would
 not worry about optimizing the insert pattern.

Note that once the partitions get small enough, on bigger hardware,
there's often little need to index at that level anymore.  If you're
pulling all the records from a 50 meg db file, it'll be read in well
under a second.  Even if you hit a few partitions, it's still pretty
fast since it's at worst a sequential scan, or more likely a read from
OS level cache.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] unsubscribe

2010-03-21 Thread dev mas

unsubscribe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Licence

2010-03-21 Thread Lew

Steve Crawford wrote:

Bill Moran wrote:

In response to Jonathan Tripathy jon...@abpni.co.uk:
 
I know the PostgreSQL licence is based on the BSD licence, however 
the line which says without fee rings alarm bells, even though I 
think it means that you don't have ot pay anything to the PostgreSQL 
developers rather than if you distribute, you must not charge a fee



The without fee part means that you don't owe anyone a fee for doing 
so.


  
We all know that, but the wording certainly is ambiguous and could be 
interpreted either way. Reminds me of Ed Asner in the old Remenber, you 
can't put too much water in a nuclear reactor. nuke-plant retiree 
sketch on Saturday Night Live. (When he left, they argued about the 
interpretation and eventually decided to drain the reactor. Final line 
to waitress on the beach: Remember, you can't stare too long at a 
radiation cloud...)


It seems to me that , without fee, and without a written agreement 
could be stripped out entirely.


But I am not a lawyer. And while there is no problem asking the question 
here, if there is any actual money/liability on the line then relying on 
legal advice from geeks is about as sensible as asking your attorney for 
a custom kernel module. That goes for the whole stack of components in 
your system, not just PostgreSQL which is about the least likely to 
cause licensing problems.


In at least some jurisdictions, if one party to a contract writes the language 
without input or emendation from the other party, that allows the other party 
to impose any reasonable interpretation on the wording.  IOW, ambiguity is 
resolved in favor of the party who had no choice in the wording.


That would mean the licensee gets to determine what without fee means, not 
the licensor.


--
Lew

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] strange

2010-03-21 Thread Szymon Guz
Hi,
I've got a simple query. When I use explain analyze it lasts 7 times slower.
Why?

test_counters=# SELECT COUNT(*), xtype FROM test GROUP BY xtype ORDER BY
xtype;
  count  | xtype
-+---
  669000 | A
   84000 | B
   63000 | D
   15000 | E
  159000 | G
 7866000 | H
 100 | N
  144000 | NI
(8 rows)

Time: 3343,376 ms
test_counters=# EXPLAIN ANALYZE SELECT COUNT(*), xtype FROM test GROUP BY
xtype ORDER BY xtype;
   QUERY PLAN

-
 Sort  (cost=243136.22..243136.24 rows=8 width=2) (actual
time=24306.075..24306.083 rows=8 loops=1)
   Sort Key: xtype
   Sort Method:  quicksort  Memory: 25kB
   -  HashAggregate  (cost=243136.00..243136.10 rows=8 width=2) (actual
time=24306.030..24306.038 rows=8 loops=1)
 -  Seq Scan on test  (cost=0.00..193136.00 rows=1000 width=2)
(actual time=0.013..11365.414 rows=1000 loops=1)
 Total runtime: 24306.173 ms
(6 rows)

Time: 24306,944 ms


regards
Szymon


[GENERAL] Full Text Search: howto manage multiple languages ?

2010-03-21 Thread Cédric MOULLET
Hi,
I have the following problem with the FTS: the database contains information
in several languages. As I understand, the FTS requires to associate a
language when ts_vector is created.  Is there any way to make a kind of
international search, without having to associate a specific language to the
ts_vector ? I must admit that it's quite ambiguous, but let's imagine that
you have a worldwide address repository. In that case, you can find Rue,
Street, Strasse etc... which have all a low significancy.
Thanks in advance for any tips,
Cédric

-- 
Welcome to my world: http://www.cedricmoullet.com/
My Linked In profile: http://www.linkedin.com/in/cedricmoullet
Twitter: http://twitter.com/cedricmoullet


[GENERAL] DBT-2 Installation error

2010-03-21 Thread Megha
Hi


I am beginner with postgres and DBT-2 database .

I am getting many errors with installation of DBT-2(dbt2-0.40)

I followed the instructions in Readme but I am not getting solution.

 I build the database according to README. *build_db.sh -g -w 1
then I *run the workload run_workload.sh -d 300 -w 1

I check the error.log in output/9/Client folder. I am getting these errors.
I run 9 test . I am getting same kind of error in all of them.


Please Help..


Tue Mar 16 21:12:36 2010
tid:-1216784704 client.c:129
2 DB worker threads have started
Tue Mar 16 21:12:39 2010
tid:-1229374608 libpq/dbc_stock_level.c:36
ERROR:  function stock_level(integer, integer, integer) does not exist
LINE 1: SELECT stock_level(1, 1, 20)
   ^
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.

Tue Mar 16 21:12:43 2010
tid:-1227277456 libpq/dbc_payment.c:37
SELECT payment(1, 10, 0, 1, 10, 'OUGHTESEPRI', 1036.87)
ERROR:  function payment(integer, integer, integer, integer, integer,
unknown, numeric) does not exist
LINE 1: SELECT payment(1, 10, 0, 1, 10, 'OUGHTESEPRI', 1036.87)
   ^
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.

Tue Mar 16 21:12:47 2010
tid:-1229374608 libpq/dbc_payment.c:37
error.log 499L, 25450C


Thanks,


-- 
Megha



-- 
Megha


Re: [GENERAL] strange

2010-03-21 Thread Tom Lane
Szymon Guz mabew...@gmail.com writes:
 I've got a simple query. When I use explain analyze it lasts 7 times slower.
 Why?

You've got a machine where gettimeofday() is really slow.  This is
common on cheap PC hardware :-(

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] How to add an external lib to PG

2010-03-21 Thread chaoyong wang

Hi,
I build PG on VS2005, which files should I change to use a external lib in 
my own contrib, for example, Berkeley DB 4.8.26?
 
Until now, I have tried the following 2 ways, but both failed.

1. Add the target include and lib
   1). src/tools/msvc/config.pl
add a new line: db48='C:\Program Files\Oracle\Berkeley DB 4.8.26' 
   2). src/Makefile.global.in
Add a new line after line 435 LIBS := -lpgport $(LIBS) (maybe not 
exactly same with different versions): LIBS := -ldb48 $(LIBS)
   3). contrib/mycontrib/Makefile
SHLIB_LINK += $(filter -ldb48, ($LIBS))
Then I build DEBUG in Visual Studio 2005 Command Prompt, it reports 
db.h not found.

2. The first error report shows that the include file is not accessed
   I changed the congiture option --with-libxml to yes, and add the files 
of include and lib under Berkeley DB 4.8.26 to libxml folder. 
   When I build, it reports: fatal error LNK1120: 2 unresolved externals
   Then I check the single project on VS2005, there is no libdb48.lib in 
the Linker input, after I added BDB_DIR\lib\libdb48.lib to it. It build 
successfully.

But I want to build the whole PG source with mycontrib, Had someone ever 
encounter a problem like this?  
 
   
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969