Re: [SQL] [JDBC] maxconnection

2003-06-19 Thread Paul Thomas
On 17/06/2003 10:22 zhuj wrote:
hi,all:
I want to constraint the maximum number of concurrent connections to
25
in postgres
jdbc driver. There are no methods for this
change. How would i do?
The simplest way is to use a connection pool.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] Delete duplicates

2003-06-22 Thread Paul Thomas
On 22/06/2003 10:15 Rudi Starcevic wrote:


Hi,

I have a table with duplicates and trouble with my SQL.
I'd like to keep a single record and remove older duplicates.
For example below of the 6 recods I'd like to keep records
4 and 6.
TABLE: aap
 id | keyword
+-
  1 | LEAGUE PANTHERS
  2 | LEAGUE PANTHERS
  3 | LEAGUE PANTHERS
  4 | LEAGUE PANTHERS
  5 | LEAGUE BRONCOS
  6 | LEAGUE BRONCOS
Here is my SQL so far, it will select records 1 to 5 instead
of 1,2,3 and 5 only.
Any help greatly appreciated. I think I need a Group By somewhere in
there.
select a1.id
from aap a1
where id < ( SELECT max(id) FROM aap AS a2 )
AND EXISTS
(
SELECT *
FROM aap AS a2
WHERE a1.keyword = a2.keyword
)
I just tries this with 7.3.3:

select max(id), keyword from aap where keyword in (select distinct keyword 
from aap) group by keyword;

 max | keyword
---
   6 | LEAGUE BRONCOS
   4 | LEAGUE PANTHERS
(2 rows)
HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] How can I to solute this problem?

2003-07-29 Thread Paul Thomas
On 29/07/2003 07:18 LEON wrote:
I use tomcat+linux_postgresql+jsp to develop system.

I start postgresql with 1024 processes.
FE:
postmaster -i -S -N 1024 -B 2048 -D /var/lib/pgsql/data
My jsp doesn't implement connection pool.It directly connects postgresql
by jdbc.
IME, that is not a good way to do it. Use a connection pool.

After I run the Ui some times, the UI(jsp) would report "ieSorry,too many
clientslg" .The exception is SQLException.
I must restart tomcat or postgresql I can continue to running my UI.
My guess would be that you have a bug in your application which is not 
always closing the connection so eventually you exceed max_connections. 
You should always close the connection in a finally{} block so that is 
guaranteed that it will be closed regardless of any earlier exceptions 
which are thrown.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] How can I to solute this problem?

2003-07-29 Thread Paul Thomas
On 29/07/2003 17:09 Achilleus Mantzios wrote:
You may take a look at jboss connection pool
mechanism. (postgresql.xml)
He doesn't mention JBoss, just Tomcat so I don't believe the 
postgresql.xml will help him much. He could use Tomcat's built-in 
connection pooling 
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html) 
but should note that there is an error in the web.xml fragment: 
jdbc/mydb should be 
jdbc/postgres. Leon, if you need more help 
please feel free to contact me off-list.

Also a good way of ensuring that your app will
not leave open stale postgresql connections
is to initially configure your pool to only have a small
number of connections (e.g. 2,3).
Good advice for any form of connection pooling.

If your J2EE components (e.g. jsps) are fast enough
you should start facing connection shortages
only after the load on your machine increases
significantly. (and then safely increase the maximum
number of connections in your configuration (both postgresql wise
and app server (conn pool) wise).
On Tue, 29 Jul 2003, Paul Thomas wrote:

>
> On 29/07/2003 07:18 LEON wrote:
> > I use tomcat+linux_postgresql+jsp to develop system.
> >
> > I start postgresql with 1024 processes.
> > FE:
> > postmaster -i -S -N 1024 -B 2048 -D /var/lib/pgsql/data
> >
> > My jsp doesn't implement connection pool.It directly connects
postgresql
> > by jdbc.
>
> IME, that is not a good way to do it. Use a connection pool.
>
> > After I run the Ui some times, the UI(jsp) would report "ieSorry,too
many
> > clientslg" .The exception is SQLException.
> >
> > I must restart tomcat or postgresql I can continue to running my UI.
>
> My guess would be that you have a bug in your application which is not
> always closing the connection so eventually you exceed max_connections.
> You should always close the connection in a finally{} block so that is
> guaranteed that it will be closed regardless of any earlier exceptions
> which are thrown.
>
> HTH
>
>
--
==
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:+30-210-8981112
fax:+30-210-8981877
email:  achill at matrix dot gatewaynet dot com
mantzios at softlab dot ece dot ntua dot gr
---(end of broadcast)---
TIP 6: Have you searched our list archives?
   http://archives.postgresql.org

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


Re: [SQL] How can I to solute this problem?

2003-07-30 Thread Paul Thomas
On 30/07/2003 10:43 LEON wrote:
Hi,Thank your help yesterday.

Now I met a new question.
When I continued to clicking UI(jsp) some time, I will get a error in
page.It is "Http 404" and Exception is "NullPoinerExcaption".
I checked the log of tomcat. It recorded a message"connected database
failed. The user perporty is missing. It is mandoatory".
netstat | grep postgres |wc -l
The connection number is 278
lsof -i :5432 | wc -l
60
How can I solute this problem?
Is there bug in postgresql's jdbc?
Could you give me help?
You must supply the user name in your DriverManager.getConnection(url, 
user, password).

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] virus warning

2003-09-19 Thread Paul Thomas
On 19/09/2003 07:17 Tomasz Myrta wrote:
Hi
Recently I receive massive mail attack. This attack comes from some 
postgresql mailing list users. All send-to adresses are taken from users 
mailboxes which contain postgresql posts. Currently I found two kinds of 
viruses:
1. Empty post with "Undelivered message to..." body
2. Microsoft "Dear Customer... " based on www.microsoft.com design.
Both mails contains some .exe attachement.

Regards,
Tomasz Myrta
So far I've had nearly 150 of these in the last 12 hours or so. Somebody 
on these lists has a lot of explaining to do! Fortunately my spam filters 
are up to scratch and I run Linux :) Others may not be so lucky.

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] virus warning

2003-09-19 Thread Paul Thomas
On 19/09/2003 16:37 scott.marlowe wrote:
Keep in mind, if you check the headers on the emails you'll see that they

are forged.  I've been getting about 20 emails a day telling me a message

I know I didn't send was infected with a virus.

I got 432 last night inbound, some with names forged from this list,
others from names unknown.
But I don't think it's not the folks on this list, I think it's a
windows worm that looks in people's email, harvests names at random, and
forged email based on it.
Does seem to be. Just download another 200+. Mildly anoying for me with a 
DSL line. I really feel for those on dial-up :(

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] Fetch a single record

2003-12-09 Thread Paul Thomas
On 05/12/2003 21:51 David Shadovitz wrote:
I'm looking for the fastest way to fetch a single record from a table.
 I don't care what record it is.
[snip]
Have you also tried
  SELECT * from mytable limit 1
If you genuinely don't care what the record is (I assume you're justing 
testing that table is not empty?) then this might be the way to go. My 
rather limited knowledge of PG internals leads me to believe that this 
will generally cause just one page being read from disk (I'm assuming the 
99% case of no mega-sized text/bytea/whatever columns here). I'd be 
interested to know just how far off the mark by understanding is...

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] How to specify the beginning of the month in Postgres SQL syntax?

2003-12-09 Thread Paul Thomas
On 07/12/2003 16:16 [EMAIL PROTECTED] wrote:
Hello,

I need to create a view in Postgres that has a where clause of the
date < beginning of month.
i.e.:
SELECT supplier_number, Sum(amount) AS due
FROM purchase_orders
WHERE date < '2003-12-1' AND paid = 0
GROUP BY supplier_number
ORDER BY supplier_number ASC
As you can see, I've specified the 1st of December this year as the
where clause. What I want is an SQL statement that automatically
generates the first of the month. How do I do this?
I do shed-loads of these date-related queries and although it's feasible 
to write some SQL/UDF function to do what you're asking, in my experience 
it is better to process the date in your app and pass it across as a 
parameter. That way you could use the same piece of SQL to get, for 
example, data which is > month owing just by passing 2003-11-01 as the 
date. Probably what you need is to write a function which takes an 
arbitary date and returns the first date in that month/year. You _could_ 
write this as PostgreSQL User Defined Function but writing it as part of 
your app will give you a) greater flexibility as the function will be 
easily available to other parts of your application b) if your app 
language/dev environment has a source-level debugger, you will be able to 
benefit from it when debugging your function and c) someone trying to 
maintain your app in 4 years time will only need to know your application 
language, SQL and a possible (very!) few PostgreSQL-specific variations 
from the SQL language definition.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] Pgaccess problem

2003-12-16 Thread Paul Thomas
On 16/12/2003 13:29 vijaykumar M wrote:
Hi All,
I am trying to install pgaccess on a redhat 7.2 linux server with 
postgres7.4.  Everything seems to be alright but when I go to run 
pgaccess I get an error message saying

Application initialization failed: no display name and no $DISPLAY 
environment v
ariable
Error in startup script: invalid command name "image"
   while executing
"image create bitmap dnarw -data  {
#define down_arrow_width 15
#define down_arrow_height 15
static char down_arrow_bits[] = {
   0x00,0x80,0x00,0x80,0x0..."
   (file "/usr/local/pgaccess/main.tcl" line 5)

Can anyone Offer any advice on this problem?
pgaccess is a TCL application. You need to be running under X. 
--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] [JDBC] Insert Row to ResultSet problem....java.sql.SQLException: No Primary Keys

2003-12-22 Thread Paul Thomas
On 16/12/2003 15:24 Jason L. van Brackel wrote:
[snip]
. this is where I get this exception
java.sql.SQLException: No Primary Keys
 ~~~
	at 
org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(AbstractJdbc2ResultSet.java:1363)
	at 
org.postgresql.jdbc2.AbstractJdbc2ResultSet.moveToInsertRow(AbstractJdbc2ResultSet.java:697)
	at 
com.cimconsultants.EFRMigration.MigrationUtil.main(MigrationUtil.java:62)
[snip]
I'm experienced with Java, but very new to JDBC and PostgreSQL.  I'm
using the JDK 1.4, PostgreSQL 7.4, and the binary pg74jdbc3.jar
driver.
A total shot in the dark but do you have a primary key on the table?

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] Index not used - now me

2004-02-09 Thread Paul Thomas
On 09/02/2004 12:50 Christoph Haller wrote:
I know there have been dozens of threads on this subject and
I have searched the archives well (I hope at least), but still ...
I have
select version();
   version
--
 PostgreSQL 7.3.4 on hppa-hp-hpux10.20, compiled by GCC 2.8.1
show enable_seqscan ;
 enable_seqscan

 off
\d ParDef_DimRange
Table "public.pardef_dimrange"
Column |   Type   | Modifiers
---+--+---
 primary_key   | integer  | not null
 dim_pointer   | smallint | not null
 dimensions_nr | smallint | not null
 first | smallint | not null
 last  | smallint | not null
 max_range | smallint | not null
Indexes: pd_dptr_index btree (dim_pointer),
 pd_pkey_index btree (primary_key)
explain analyze SELECT Dim_Pointer,Dimensions_Nr,First,Last   FROM
ParDef_DimRange
 WHERE Dim_Pointer = 162::smallintORDER BY Dim_Pointer,Dimensions_Nr;
QUERY PLAN
---
 Sort  (cost=7.02..7.03 rows=2 width=8) (actual time=0.72..0.75 rows=2
loops=1)
   Sort Key: dim_pointer, dimensions_nr
   ->  Index Scan using pd_dptr_index on pardef_dimrange
(cost=0.00..7.01 rows=2 width=8) (actual time=0.20..0.28 rows=2 loops=1)
 Index Cond: (dim_pointer = 162::smallint)
 Total runtime: 1.24 msec
excellent, but

explain analyze SELECT Dim_Pointer,Dimensions_Nr,First,Last   FROM
ParDef_DimRange
 WHERE Dim_Pointer = 162ORDER BY Dim_Pointer,Dimensions_Nr;
  QUERY PLAN
---
 Sort  (cost=10062.22..10062.23 rows=2 width=8) (actual
time=32.44..32.46 rows=2 loops=1)
   Sort Key: dim_pointer, dimensions_nr
   ->  Seq Scan on pardef_dimrange  (cost=1.00..10062.21
rows=2 width=8) (actual time=11.06..31.93 rows=2 loops=1)
 Filter: (dim_pointer = 162)
 Total runtime: 32.79 msec
That's not nice. Will this go away on 7.4?
No. AFAIK, 7.4 is still very strict about column types so will still need 
to explicitly cast to smallint.

\d Transfer_ModRange
   Table "public.transfer_modrange"
 Column |   Type   | Modifiers
+--+---
 module_pointer | smallint | not null
 from_module| smallint | not null
 to_module  | smallint | not null
 primary_key| integer  | not null
Indexes: tmr_primkey_index btree (primary_key)
explain analyze SELECT Module_Pointer FROM Transfer_ModRange
 WHERE Primary_Key  = 13 AND From_Module <= 2 AND To_Module   >= 2 ;
  QUERY PLAN
--
 Index Scan using tmr_primkey_index on transfer_modrange
(cost=0.00..115.09 rows=14 width=2) (actual time=2.11..2.11 rows=0
loops=1)
   Index Cond: (primary_key = 13)
   Filter: ((from_module <= 2) AND (to_module >= 2))
 Total runtime: 2.46 msec
Now
set enable_seqscan to on ;
explain analyze SELECT Module_Pointer FROM Transfer_ModRange
 WHERE Primary_Key  = 13 AND From_Module <= 2 AND To_Module   >= 2 ;
  QUERY PLAN
--
 Seq Scan on transfer_modrange  (cost=0.00..104.93 rows=14 width=2)
(actual time=45.91..45.91 rows=0 loops=1)
   Filter: ((primary_key = 13) AND (from_module <= 2) AND (to_module >=
2))
 Total runtime: 46.19 msec
That's odd. May I please have an explanation for this.
Probably I should mention both tables have far less than 10.000 tuples.
VACUUM and ANALYZE was done just before.
That's because it's acually more efficent to do a seqscan on your small 
table. When you have only a small table (like many of us do when testing), 
the whole table will probably fit on one 8K page so the lowest cost 
operation (= quickest) is to get that page.  It was disabling seqscan that 
was forcing an index scan to appear to be the least costly operation. BTW, 
you can't actually prevent PG doing a seqscan if there's no alternative 
plan. All set enable_seqscan = false does is make a seqscan appear very 
expensive so that the planner is less likely to pick it.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+

Re: [SQL] Index not used - now me

2004-02-09 Thread Paul Thomas
On 09/02/2004 15:02 Christoph Haller wrote:
[snip]
Thanks for your reply so far, but there is one thing I still don't
understand.
You wrote
It was disabling seqscan that
was forcing an index scan to appear to be the least costly operation.
Why appear? If the Index Scan has a Total runtime: 2.46 msec and the Seq
Scan
a Total runtime: 46.19 msec, then the Index Scan is much faster.
Or am I completely off the track reading the explain analyze output?
No, I think it's me who's not reading the output correctly :( I didn't 
look closely enough to spot the run time difference. How many rows are 
there in the table?

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] where not unique

2004-03-12 Thread Paul Thomas
On 12/03/2004 13:02 Gary Stainburn wrote:
Hi folks,

I've got a table which contains amongst other things a stock number and a

registration number.  I need to print out a list of stock number and reg
number where reg number is not unique (cherished number plate transfer
not
completed).  I've tried variations of a theme based on
select stock_number, registration from stock where registration in
  (select registration, count(registration) as count
 from stock where count > 1 group by registration);
but I have two problems.  Firstly with the sub-select I get:

usedcars=# select registration, count(registration) as count from stock
where
count > 1 group by registration;
ERROR:  Attribute 'count' not found
usedcars=#
although if I miss out the where clause I get the expected results.

Secondly, when I run the full query I get:

usedcars=# select stock_number, registration from stock
usedcars-# where registration in
usedcars-# (select registration, count(registration) as count from stock
group
by registration);
ERROR:  Subselect has too many fields
usedcars=#
which is obviously because of the count field.

Can anyone tell me where I'm going wroing with these count fields?
(I've tried renaming the field to regcount in case it was a reserved word
problem)
If I understand you correctly, you've got something like

  mytable
stockno  regno
--
SN1  REG1
SN2  REG2
SN3  REG3
SN4  REG2
and you want to list REG2. Something like

select regno from mytable group by regno having count(stockno) > 1;

might do it.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] Invalid Characters

2004-03-15 Thread Paul Thomas
On 15/03/2004 10:37 Raman wrote:
Hi All,

I have imported some data from csv files in my DB. Now that data has some
invalid characters stored in it.
so I get this exception:
Exception in ChannelDAO Invalid character data was found.  This is most
likely caused by stored data containing characters that are invalid for
the character set
 the database was created in.  The most common example of this is storing
8bit data in a SQL_ASCII database.
Now, I tried using to_ascii() fn in my select query but it didn't work.
Cn you please suggest any solution so that invalid characters should not
come to my webpage while displaying.
Regards
Raman Garg
Use UNICODE as the db encoding. You'll have to drop and re-create the db 
though.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] how to turn off autocommit in psql

2004-03-26 Thread Paul Thomas
On 26/03/2004 01:25 Kemin Zhou wrote:
I search far and wide and found a lot of disscussions about the 
autocommit, but none about how to do it. After reading 50 pages, my 
brain is numb.  Could any one give me a simple help?
Thanks

Kemin
Use tranactions.

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

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


Re: [SQL] partial unique constraint

2004-04-06 Thread Paul Thomas
On 06/04/2004 15:29 Robert Treat wrote:
Trying to come up with the proper syntax to meet the following criteria:

create table foo (bar integer, baz boolean UNIQUE (bar, baz = true));

note the above syntax is not correct, but should demonstrate what i'm
trying to do; I want to add a unique constraint such that we only allow
one case of bar and baz = true...  i can have unlimited bar and baz =
false, and there can be multiple bar and baz = true if the bars are
different...  did some doc reading and mail list searching but a valid
syntax for this seems to be escaping me...
btw I'm pretty sure I could do this with an external trigger, but am
wondering about a constraint oriented approach
What about

create table foo (bar integer, baz boolean);

create unique index foo_bar_baz on foo(bar, baz) where baz = true;

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] problem porting MySQL SQL to Postgres

2004-04-15 Thread Paul Thomas
On 15/04/2004 11:25 Dan Field wrote:
I've stumbled across a query I don't quite understand the error message 
for.

This query is pulled from a working MySQL setup:

SELECT
	DEWEY_ID, DEWEY_HUNDREDS, DEWEY_TENS, DEWEY_ONES, 	 
DEWEY_POINT_ONES, DEWEY_POINT_TENS, 	 	DEWEY_POINT_HUNDREDS, 
DEWEY_POINT_THOUSANDS,  	DEWEY_TYPE, DEWEY_LANG,  DEWEY_SUBJECT  
FROM lu_dewey
WHERE
	(DEWEY_HUNDREDS = 9) AND
	(DEWEY_TENS >= 0) AND 	 	(DEWEY_TENS <= 9) AND
	(DEWEY_ONES = 0 || DEWEY_ONES = NULL) AND
	(DEWEY_POINT_ONES = 0 || DEWEY_POINT_ONES = NULL) AND
	(DEWEY_POINT_TENS = 0 || DEWEY_POINT_TENS = NULL) AND
	(DEWEY_POINT_HUNDREDS = 0 || DEWEY_POINT_HUNDREDS = NULL) AND
	(DEWEY_POINT_THOUSANDS = 0 || DEWEY_POINT_THOUSANDS = NULL) AND
	(DEWEY_TYPE = 't') AND
	(DEWEY_LANG = 'en')
ORDER BY DEWEY_TENS

However I'm getting the following error:

 ERROR:  Unable to identify an operator '=' for types 'character' and 
'boolean' You will have to retype this query using an explicit cast.

Any help would be much appreciated
You're trying to use the string concatenation operator (||) in a boolean 
test.. That's an invalid comparison according to the SQL specs. You need 
to use the SQL OR operator e.e.,

(DEWEY_POINT_TENS = 0 OR DEWEY_POINT_TENS = NULL) AND
  ~~
Your "= NULL" tests are also not valid SQL (should be IS NULL). MySQL does 
not follow the specs in a number or areas. PostgreSQL is very 
standards-complient. Write valid SQL and you should be OK.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] problem porting MySQL SQL to Postgres

2004-04-18 Thread Paul Thomas
On 18/04/2004 19:37 Markus Bertheau wrote:
В Чтв, 15.04.2004, в 13:15, Paul Thomas пишет:
> On 15/04/2004 11:25 Dan Field wrote:
> Your "= NULL" tests are also not valid SQL (should be IS NULL).

I think = NULL _is_ valid SQL, it just doesn't do what you think.
It's valid in an assignment

	update foo set bar = null;

PostgreSQL can be coerced into accepting where foo = null with the 
transform_null_equals run-time option but that doesn't make it legal SQL 
IFAIK.

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] \D TO FILE

2004-05-03 Thread Paul Thomas
On 03/05/2004 12:49 Eric Anderson Vianet SAO wrote:
How could I record the ´ \d table ´ command to a file?
\o file
HTH
--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] Performance issue

2004-04-27 Thread Paul Thomas
On 27/04/2004 10:12 Michael L. Hostbaek wrote:
[snip]
Is this normal ? If I run the same select on another table in the same
database with ~40.000 rows, it takes approx 820.00ms...
You would probably get better answers on the correct list but my guess is 
that your fsm setting might be too low for the number of dead tuples you 
are trying to reclaim so the vacuum is not clearing all the dead stuff 
out. There's plenty of stuff about this in the archives and the docs.

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] Doubt

2004-09-28 Thread Paul Thomas
On 22/09/2004 12:11 S.Sreejith wrote:
 Sir,
  I am new to PostgreSQL. I have a doubt. Now i am doing one project
in .NET technology with postgres(linux) as database. I am using pgADMIN
and pgManager as tools for database releted activities. Now i am able to
create functions with 'sql' language. When i select 'pgsql' as language
for creating query, an error poping up. How to create Query using 'pgsql'
language. if any new tools need to be installed. Plz rectify. Mail me back
at [EMAIL PROTECTED]
I bet you haven't enabled pl/pgsql use createlang. Read the docs.
--
Paul Thomas
+--+---+
| Thomas Micro Systems Limited | Software Solutions for Business   |
| Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk |
+--+---+
---(end of broadcast)---
TIP 8: explain analyze is your friend