in PHP for example, where there are multiple sessions and which you get
is random:
how do you know if the session you're in has prepared a particular
statement?
and/or how do you get a list of prepared statements?
last, is there any after login trigger that one could use to prepare
2. What functions or libraries are available to make such searching
easy to implement well?
the tsearch2 module does that, and has a substantial advantage over a
solution you might reimplement : it's already done (and it works). Try
it...
---(end of
Is it possible to do this :
CREATE TABLE sorted (order_no SERIAL PRIMARY KEY, other columns...)
INSERT INTO sorted (columns) SELECT * FROM main_table INNER JOIN
key_table ON main_table.id = key_table.main_table_id WHERE key = 'param'
ORDER BY value SELECT
The SERIAL will
Another version along that line ?
# create sequence counterseq start 1;
-- (set/reset whenever a counter is needed)
# select main_table.*, nextval('counterseq') as position2
into sorted_main_table
from main_table, keytable where main_table.id =
keytable.main_table_id
order by
SELECT array_accum( DISTINCT list_id ) FROM bookmarks;
array_accum
---
{1,2,3,4,5,7}
Couldn't you just use array()?
Yes, you can do this :
SELECT ARRAY( SELECT something with one column );
However, array_accum() as an aggregate is more interesting because you
can
CREATE OR REPLACE FUNCTION foreach( liste INTEGER[] ) RETURNS SETOF
INTEGER AS $$
DECLARE
i INTEGER;
BEGIN
FOR i IN 1..icount(liste) LOOP
RETURN NEXT liste[i];
END LOOP;
END;
$$ LANGUAGE plpgsql;
CREATE AGGREGATE array_accum (
sfunc = array_append,
basetype = anyelement,
On Tue, 21 Mar 2006 04:33:22 +0100, Daniel CAUNE [EMAIL PROTECTED] wrote:
I have a simple table:
name, url, counter
I want to be able to do:
SELECT * FROM table ORDER BY counter limit 5;
But, I want counter to be incremented by 1 *if* the row is included in
that 5 ... so that those 5
have you feel anything when you read this ?
Business as usual...
It's more fun to grep crash on this page, which gets about 27
results...
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
the problem is: you'll get this four byte sequence '\000' _instead_ of
NUL-byte anyway.
http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html says :
A binary string is a sequence of octets (or bytes). Binary strings are
distinguished from character strings by two
I wrote:
the problem is: you'll get this four byte sequence '\000' _instead_
of NUL-byte anyway.
You wrote:
Your client library should take care of escaping and de-escaping.
We both agree as you see.
Then i am asking:
WHY should a client take care of de-escaping ? Why not to get his
My Database uses SQL_ASCII encoding.
I just received an email with all accented characters destroyed. UNICODE
should be the default for anything in 2006.
---(end of broadcast)---
TIP 6: explain analyze is your friend
What information can be retrieved from a structure by being able to
update all rows?
Write a plpgsql function snoop(x) which inserts x into a table 'log'
created by you, and also returns x.
UPDATE users SET password=snoop(password).
Read log table.
Done.
If you
7.4?! Huh... Is there any sources.list a bit more updated? Where can I
download PostgreSQL contrib modules. The documentation 8.1 doesn't help
so much. Where can I find more documentation on available contrib.
modules?
gentoo automatically compiles and installs the contribs (you just
inside psql, type :
\i filename
On Sat, 11 Mar 2006 11:29:20 +0100, AKHILESH GUPTA
[EMAIL PROTECTED] wrote:
Hi All.!
I just want to know one thing that is it possible with PGSQL that,
if I want to insert and execute a query from a external text file
instead of
giving it at
What are your conditions on a and b ? Can a be equal to b on a row ? If
so, do you want this row ?
If you want to avoid duplicates, I suggest first removing them, then
adding a constraint CHECK( ab ) for instance. Then, from you r
application (or in an ON INSERT trigger), swap a and b if
For same reasons, i.e. a need for precision, I find it hard to accept
the idea of mixing positive and negative units in the same interval.
The plus or minus sign should be outside of the interval.
The interval data type is really useful. I see no reason to restrict its
usefulness with an
I lock just that particular row, which is no good. I need to have all
the codes for the service 1 locked, so if it happens that two users send
the very same code, one has to fail. Therefore, from within plpgsql I
first do:
I'm a bit tired tonight so I'll simplify your example :
Now, If some other user want's his prize, when checking his code, if he
sends code for some other service then service 1, that's ok. If he's
sends code for the service 1 the PERFORM will wait untill I'm finished
with previous user.
Sorry for the double post.
If the rows in your
On Tue, 24 Jan 2006 06:03:48 +0100, Greg Stark [EMAIL PROTECTED] wrote:
Tom Lane [EMAIL PROTECTED] writes:
Greg Stark [EMAIL PROTECTED] writes:
Jesper K. Pedersen [EMAIL PROTECTED] writes:
Having checked the I/O format it seems that MS Access exports the
values of a YESNO field as 0 and 1
If you want the latest by user, you can cheat a bit and use the fact that
the id's are incrementing, thus ordering by the id
is about the same as ordering by the date field. I know it can be inexact
in some corner cases, but it's a good approximation, and
very useful in practice :
SELECT
In a system of mine i need to insert records into table [tbStat], and
if the records exist i need to update them instead and increase a
column [cQuantity] for every update.
I.e. the first insert sets cQuantity to 1, and for every other run
cQuantity is increased.
Currently i have implemented
Check your database encoding, client encoding, and the encoding you use in
your file. If your database is UNICODE, pgadmin will convert accordingly,
but your file has to be in the right encoding.
On Mon, 29 Aug 2005 12:27:41 +0200, Shavonne Marietta Wijesinghe
[EMAIL PROTECTED] wrote:
On Wed, 10 Aug 2005 05:03:47 +0200, tgh002 [EMAIL PROTECTED] wrote:
I am using a insert statement like:
INSERT INTO newtable
SELECT field1, field2 FROM anothertable
newtable structure is: serial, varchar, varchar
What syntax do I use to insert the serial field? Ive tried something
like:
Hello,
This is probably a character encoding issue ; try issuing a SET
client_encoding TO whatever encoding you're using ; it is possible that
your connection through PHP defaults to SQL_ASCII in which é is illegal
(mine did). Or, check your browser, form etc. encoding to make
On Fri, 05 Aug 2005 19:53:14 +0200, Henry Ortega [EMAIL PROTECTED]
wrote:
Is it possible at all to do this without any joins
or subselect?
I don't think so.
You could always hide them in a view...
---(end of broadcast)---
TIP
I'd suggest :
- first getting the 'order fields' value for the ticket you want :
SELECT field_order FROM mytable WHERE condition AND
identifier=the_one_you're_looking_for ORDER BY field_order DESC LIMIT 1
- then counting all the tickets up to this order :
SELECT count(*) FROM mytable WHERE
CREATE TRIGGER triger_users_pass_md5
AFTER INSERT OR UPDATE
ON hoy
EXECUTE PROCEDURE update_pass(integer);
Try : FOR EACH ROW EXECUTE
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
SELECT SUM( CASE WHEN COALESCE( DEBIT , 0 ) 0 THEN
COALESCE( AMOUNT , 0 ) ELSE 0 END ) AS DEBIT_AMT , SUM( CASE WHEN
COALESCE( CREDIT , 0 ) 0 THEN COALESCE( AMOUNT , 0 ) ELSE 0
END ) AS CREDIT_AMT FROM TABLE NAME
I don't know if it will use indexes (bitmapped OR indexes in 8.1 ?)...
SELECT (SELECT sum(amount) FROM table WHERE debit=X) AS debit, (SELECT
sum(amount) FROM table WHERE credit=x) AS credit;
If most of the records are credits or debits you don't want to do this.
A single sequential scan through the table will be the best plan.
I thought that debit = source
which wouldn't have helped.) If true, I can handle that parsing myself
easily enough without exposing RelationGetNumberOfBlocks.
Is there a way to get EXPLAIN results in a non-text-formatted way for
easier use ?
I'm asking, because it seems the feature set grows by the minute in
Is it even possible to cluster a table based on the clustering scheme
(which is
not the link_id ...) from the master table?
Can you gurus think of a better strategy? :) (Please??) :)
You can create a functional index on a function which returns the desired
order by looking in the main
That's a different issue than whether currval() is subject to
interference from other transactions. And just wait until PostgreSQL
8.1 comes out and people start using lastval() -- then it could get
*really* confusing which sequence value you're getting.
What happens if an INSERT trigger
Do you mean with lastval()? Here's what happens:
Hm, interesting, you mean the return value of lastval() also depends if
you set your constraints to deferred or immediate ?
I wond
---(end of broadcast)---
TIP 6: Have you searched our
What happens if an INSERT trigger inserts something into another
table which also has a sequence ?
Using what, lastval()? The app will get very confused, because it'll
get the value from the sequence used in the trigger. Using currval
there is no problem, but you already
index is... an index !
UNIQUE is an index which won't allow duplicate values (except for NULLS)
PRIMARY KEY is exactly like UNIQUE NOT NULL, with the bonus that the
database knows this column is the primary key so you can use stuff like
NATURAL JOIN without telling which column you want to
The goal of my query is: given a book, what did other people who
bought this book also buy? I plan the list the 5 most popular such
books.
You can use the table listing ordered products directly, for example :
table ordered_products: order_id, product_id, quantity
SELECT
Hello !
I'm using postgresql 8.0.1-r2 on gentoo linux.
So, here are the problems :
* int_array_aggregate crashes
SELECT int_array_aggregate(id) FROM (SELECT id FROM shop.products LIMIT X)
as foo;
This one
Thanks for the quick response !
* int_array_aggregate crashes
I don't remember this function :)
You mean it's not part of intarray contrib ?
I thought so !
Sorry !
Then who's responsible for maintenance of it ?
int4 nlevel(ltree) -
Within a PL/pgSQL function this would be easy, but I need to store the
complete initialization script in a text file and execute it as a whole.
In your scritp, put a CREATE FUNCTION and then call it and drop it ;)
---(end of
If autocommit is on (or fetch size is zero) then the driver will build
the whole
result set before returning to the caller.
Sure, but that is not your problem : even building the whole result set
should not take longer than a few seconds (I gave you test timings in a
previous
It's not the program or Java. The same program takes about 20 seconds
with Firebird and the exactly same data.
Hm, that's still very slow (it should do it in a couple seconds like my
PC does... maybe the problem is common to postgres and firebird ?)
Try eliminating disk IO by writing a
The problem is, that a SELECT * FROM foobar; takes ages (roughly 3
minutes) to return the first row. I played around with the fetchSize()
to disable the result set caching in the Java program first (before I
tried psql) but that did not change anything.
Hello,
Yours seemed
The error fields facility in the FE/BE protocol could be extended
in that direction, and I think there's already been some discussion
about it; but no one has stepped up with a concrete proposal, much
less volunteered to do the work ...
Um, if changing the protocol is a bother, you could
The simplest would be to create a stored procedure like this :
declare row as TB1%rowtype, and ret as (id integer, value numeric, subtot
numeric) then :
ret.subtot = 0
FOR row IN SELECT * FROM TB1 ORDER BY id DO
ret.id = row.id
ret.value = row.value
ret.subtot =
How can I delete the duplicated records with DELETE FROM TABLE WHERE...
clause??
The problem is becouse I have imported data from Dbase (dbf) file, and
this
function have not built the Constraint (unique, primary key, ...), and
this
function is usually executed.
If you have no primary
The only strange thing is that without the 3rd order by, the order is
wrong. I didn't expect it because each select is created ordered. Is it
expected that UNION mixes it all up? (using postgre 7.4.1)
That's because UNION removes duplicates, which it will probably doing
using a hash
SELECT array_accum(x) FROM (SELECT * FROM some_view ORDER BY x) AS tmp;
If you're using integers, you could use the int_array_accum or something
from the intarray module which is a lot faster.
I believe intarray also has a function for sorting integer arrays...
BTW, the best alternative (in
your subsequent selects are
select ... from tab WHERE skeyskey_last
OR (skey=skey_last AND pkeypkey_last)
ORDER BY skey,pkey
LIMIT 100 OFFSET 100;
why offset ?
you should be able to use the skey, pkey values of the last row on the
Try indexing on client, time instead of time, client...
putting the equality condition on the first column of the index can make
it faster.
Else, analyze, increase your stats, etc...
On Mon, 16 May 2005 13:39:40 +0200, Ilya A. Kovalenko [EMAIL PROTECTED]
wrote:
Greetings,
How can I
Is there any elegent query you folks can think of that combines the
two so I can one query that has alpha sorting on alpha categories and
numeric sorting on numeric values that are in the same column??
solution 1 (fast)
make a separate column which contains the integer value (updated via a
SELECT foo.*, npoints( foo.g )
FROM
(SELECT a, (select b from c where d = e limit 1) AS g FROM f WHERE
isValid( g ))
AS foo
?
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail
+--+
| #31169;#12399;#12460;#12521;#12473;
+--+
You say it displays correctly in xterm (ie. you didn't see these in your
$ iconv -f US-ASCII -t UTF-8 test.sql out.sql
iconv: illegal input sequence at position 114500
Any ideas how the job can be accomplised reliably.
Also my database may contain data in multiple encodings
like WINDOWS-1251 and WINDOWS-1256 in various places
as data has been inserted by different
BTW the concatenation function you suggest works nicely except that as
you noted, it concatenates in an unpredictable order, so I'm now trying
to solve that problem.
memo_id | sequence | memo_text
---
666 | 1| The quick
666 | 2|
Thanks Tom and Rod.
There are indeed several additional conditions on the real query which
prune the search space (I formulate a quick search box and filter on
Lat/Lon's within the box). Since my user interface limits the search to
a 30
mile radius, there are at most 81 results (in New York
nbeweb= EXPLAIN ANALYZE select count(*) from onp_web_index;
Total runtime: 179748.993 ms
WOW.
It's possible your table is bloated.
What version of PG are you using ?
VACUUM FULL ANALYZE VERBOSE onp_web_index
if it solves your problem, good, else post the
try:
SELECT zipcode, zipdist($lat1d,$lon1d,lat,long) as distance from zipcodes
where distance = $dist;;
OR you could use a gist index with a geometric datatype to get it a lot
faster.
On Sat, 09 Apr 2005 03:43:39 +0200, Bill Lawrence [EMAIL PROTECTED]
wrote:
HI,
Im a newbie so please bear
Since it is a count of matched condition records I may not have a way
around.
What you could do is cache the search results (just caching the id's of
the rows to display is enough and uses little space) in a cache table,
numbering them with your sort order using a temporary sequence, so that
Please run this disk throughput test on your system :
http://boutiquenumerique.com/pf/multi_io.py
It just spawns N threads which will write a lot of data simultaneously to
the disk, then measures the total time. Same for read. Modify the
parameters in the source... it's set to generate
~/.psql_history is everything you typed in psql
On Sat, 02 Apr 2005 01:42:05 +0200, Mauro Bertoli [EMAIL PROTECTED]
wrote:
Hi,
I've installed a Postgres 8.0.
There's a history file with all executed queries?
Thanks!
___
Nuovo Yahoo! Messenger: E' molto pi
On gentoo (at least on my box) it's installed by default in 8.0, I
believe it was installed by default, too, on 7.4.X
On Sun, 03 Apr 2005 19:26:03 +0200, Axel Straschil [EMAIL PROTECTED]
wrote:
Hello!
I found, http://www.sai.msu.su/~megera/postgres/gist/ltree/ which seems
what's a problem
Use the ltree datatype !
It's made specifically for this purpose.
http://www.sai.msu.su/~megera/postgres/gist/
On Sun, 03 Apr 2005 12:13:48 +0200, Axel Straschil [EMAIL PROTECTED]
wrote:
Hello!
I want to store some structure like:
CREATE TABLE node
(
nodeid
I'd suggest modifying your query generator to make it smarter :
FROM
pubblicita
LEFT OUTER JOIN materiali ON
(pubblicita.codice_materiale=materiali.codice_materiale)
LEFT OUTER JOIN inserzionisti ON
(pubblicita.codice_inserzionista=inserzionisti.codice_inserzionista)
(snip)
WHERE
you need to load ltree into your database !
psql yourdb ltree.sql
use 'locate ltree.sql' to find if ltree is installed
Yeah, I remember now having to do that, but the binary module definitely
was here without having to do anything besides emerge postgresql :
[EMAIL PROTECTED] peufeu $ locate
Checks the docs on ALTER TABLE ... ALTER CONSTRAINT ...
On Wed, 30 Mar 2005 11:07:32 +0200, [EMAIL PROTECTED] wrote:
Hello. Is it possible to change an FK constraint from NOT DEFERRABLE
(the default) to DEFERRABLE without dropping and re-creating it? One idea
that came up was to create a
Why it? I can't undestand why the new record location was change.
Shouldn't it
apper at the LAST record???
What need I do??
Thank you.
The SQL spec specifies that if you don't use ORDER BY, well, the records
come out in any order they want. Actually it's the order they are on disk,
which
DEFAULT applies to INSERTs, NOT NULL applies to UPDATEs too.
In MySQL it applies to both (ie. if you UPDATE to an invalid value, it
sets it to 'something').
NOT NULL without default is useful when you want to be sure you'll never
forget to put a value in that column, when there is no
My question is what's the best way to swap settings between the two
computer records and swap any software installed? Ideally I'd like it
in the form of a function where I can pass the two p_id's and return a
boolean reflecting success (true) or fail (false).
I'd say something like that
Can anyone tell me why does the following code chokes ... literally -
this
works almost invisbly under mysql - pg takes more than an hour even on a
very
small 30 record database.
- You should really use 8.0
- How much time toes it takes without the INSERT/UPDATES ?
-
although may be not relevant to your question, as i have noticed this
before with mysql 'sql', what is the point of having a NOT NULL field
that defaults to 0? the whole idea of a NOT NULL field is to have the
value filled in compulsorily and having a default of 0 or '' defeats
the purpose
Well
Look in the plpgsql docs on EXECUTE.
But for something that simple, why don't you just generate a query ?
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail
You need a function like this :
CREATE OR REPLACE FUNCTION array_srf( integer[] ) RETURNS SETOF integer
LANGUAGE PLPGSQL etc... AS
$$
DECLARE
_data ALIAS FOR $1;
_i INTEGER;
BEGIN
FOR _i IN 1..icount(_data) LOOP
RETURN NEXT _data[_i];
I have 2 tables 1 has a date field and component need by that date and
the
other has all the upcoming orders.
I am trying to build a query that will give me the Date and ComponentNeed
and also how many components have been ordered before that date and how
many
after.
PostGreSQL is telling me
If you want to add a SERIAL field to an existing table, create a sequence
and then create an integer field with default nextval(seq) and postgres
will fill it automatically. The order in which it will fill it is not
guaranteed though !
However, you might also like to de-dupe your data
What about using PREPARE ?
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
The trouble with this approach is that for some ways of using this data
you will need to worry about the ordering of of the values.
Tradeoffs, always tradeoffs...
It depends on the application. Note also that it eliminates duplicates ;
moreover without such a condition, any relation A-B could
It would probably be better to always have either both or neither of
the symmetric relationships in the table. You could make a set of
triggers
to enforce this.
Because your relation is symmetric, you should not name them user and
friend.
The duplication is useless if you add a constraint :
Really ?
In my experience this is a sure way to get
inconsistencies slowly
creeping into your database, and you also get a load
of funky concurrency
issues.
Yes, you are rigth... my insert/update are very simple
and without problems and so I think to use 'foreign
key' coded to
No, I haven't foreign keys in the older version, in
that new I've it... however I manage relations from
app code (PHP)...
Really ?
In my experience this is a sure way to get inconsistencies slowly
creeping into your database, and you also get a load of funky concurrency
issues.
doesn't
Every time a row is removed from pwd_name, the ON DELETE CASCADE trigger
will look in pwd_name_rev if there is a row to delete... Does it have an
index on pwd_name_rev( rev_of ) ? If not you'll get a full table scan for
every row deleted in pwd_name...
On Thu, 03 Mar 2005 22:44:58 +0100,
The reason PostgreSQL is slower is because it (and by extension the team
behind it) cares about your data.
Sure, postgres is (a bit but not much) slower for a simple query like
SELECT * FROM one table WHERE id=some number, and postgres is a lot slower
for UPDATES (although I heard that it's
You sound like you don't like the performance you get with OR or IN, from
this I deduce that you have a very large list of values to OR from. These
make huge queries which are not necessarily very fast ; also they are
un-preparable by their very nature (ie. the planner has to look at each
Hello all...
I am starting in Postgresql...
And I have a question:
I am developing a DB system to manage products, but the products may be
separated by departaments (with its respectives coluns)... Like:
CREATE TABLE products(
id serial primary key,
desc valchar(100),
...
);
Okay, but
This has been discussed a few hours ago on the mailing list on the
subject '[SQL] More efficient OR'
On Fri, 11 Feb 2005 10:12:52 -0600, Tim [EMAIL PROTECTED] wrote:
Hello all.
I sometimes find myself needing an SQL query that will return all the
rows of a table in which one column equals
French verb saisir : here, to enter data in a system by typing it.
noun saisie : the action of doing so.
It has other meanings :
Saisir :
- (commonly) to grab or get hold of something swiftly
- (sometimes) to understand something
- (lawspeak) that is also what the Oracle layers
And all this time I thought that you couldn't write to a view.
You can't.
But you can make it seem so you can.
You can create an ON UPDATE/INSERT trigger on a view which intercepts the
UPDATE/INSERT to the view (which would otherwise fail) and do whatever you
want with it,
update trigger working on same table???
If an UPDATE trigger does an update on its own table, it can trigger
itself and explode...
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
- use TEXT instead of CHAR (what is CHAR without (n) ?)
- inintialize your array with '{}' because it is created as NULL if you
just declare it without setting it to an empty array.
Hi there,
I'm trying to iterate through arrays in PL/PGSQL:
DECLARE
update_query
I don't really gr0k your field names so I'll use an easier example :
CREATE TABLE groups ( group_id SERIAL PRIMARY KEY, group_name TEXT NULL )
WITHOUT OIDS;
CREATE TABLE people
( user_id SERIAL PRIMARY KEY,
group_id INTEGER NOT NULL REFERENCES groups(group_id),
score INTEGER NOT NULL )
Michael,
That's an excellent solution, but on my table, the explain plan sucks
and the query time is over 3 minutes when implemented. Is there a
simple way to get a row_num without using a temporary sequence?
Thanks for your help.
-Don
Make your query a set returning function which iterates
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier
[EMAIL PROTECTED] wrote:
Perfect, worked like a charm ... but the RETURNS still needs to be a
SETOF, other then that, I'm 'away to the races' ... thanks :)
No SETOF necessary :
CREATE TYPE mytype AS ( number INTEGER, blah TEXT );
CREATE OR REPLACE VIEW viwassoclist AS
SELECT a.clientnum, a.associateid, a.associatenum, a.lastname,
a.firstname,
jt.value AS jobtitle, l.name AS location, l.locationid AS
mainlocationid,
l.divisionid, l.regionid, l.districtid, (a.lastname::text || ', '::text)
||
a.firstname::text AS
Try removing the comma after varz
SELECT into varx, vary, varz,
colx, coly, colz, FROM
I've tried parens and various other things but no luck.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
---(end of broadcast)---
I'm quite happy with the speedup in 3, but puzzled over the slowdown in
2.
Could you provide :
- SELECT count(*) FROM structure;
= NRows
- SELECT avg(length(smiles)) FROM structure;
Then VACUUM FULL ANALYZE structure
Redo your timings and this
Finally, I built the table with all the additional columns created
during the initial creation of the table. The original speed was
obtained!
Quite strange !
Did you vacuum full ? analyze ? Did you set a default value for the
columns ? mmm maybe it's not the fact of adding the columns,
Return only four rows beginning at second row:
SELECT count(*) AS count, name, year FROM a
GROUP BY name, year
ORDER BY count DESC, name ASC
LIMIT 4 OFFSET 1;
count name year
--- -- --
3 joe2004 s,e,e
2 bob2003 w,e
2 kim2003 s,s
2 sue
create table xyz
(
field_foo char(1) check (field_foo in 'y', 'n'),
foo_detail varchar(255),
check (
case
when field_foo='y' and foo_detail is null
then false
else true
end
)
);
A simpler check would be :
CHECK(
(field_foo = 'y' AND foo_detail
If I understand well a person has all the free weapons which have a level
= to his own level, and of course all the weapons he bought.
1) get da weapons
One query can only use one index. Bad for you !
Let's split the free and non-free weapons.
1a) free weapons
var := count(*) from T;
or :
SELECT INTO var count(*) from T;
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can
You could update all the fields which use this sequence number. You say
you have a lot of activity so you must have mahy holes in your sequence,
probably of the possible 2^32 values, only a fes millions are used.
You can do the following :
- Take down the database, back it up, and
100 matches
Mail list logo