Re: [SQL] Scalar in a range (but textual not numeric)

2004-02-25 Thread Richard Huxton
On Wednesday 25 February 2004 19:18, Richard Huxton wrote: > Large table representing non-overlapping blocks: > > blocks(id int4, min varchar, max varchar) > > SELECT * FROM blocks WHERE 'ABCDE' BETWEEN min AND max; > > The estimator gets the wrong plan because

Re: [SQL] Scalar in a range (but textual not numeric)

2004-02-25 Thread Richard Huxton
On Wednesday 25 February 2004 20:56, Joe Conway wrote: > Richard Huxton wrote: > > That's not quite the same though, because it means I need to split > > ABCAA..ABDBB into ABCAA..ABCZZ and ABDAA..ABDZZ but it's close enough > > unless someone is feeling clever this

Re: [SQL] Scalar in a range (but textual not numeric)

2004-02-25 Thread Richard Huxton
On Wednesday 25 February 2004 21:32, Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > Large table representing non-overlapping blocks: > > blocks(id int4, min varchar, max varchar) > > > > SELECT * FROM blocks WHERE 'ABCDE' BETWEEN min AN

Re: [SQL] Materialized View Summary

2004-02-24 Thread Richard Huxton
e possible in some cases, but I'm not sure how difficult it is to do in all cases. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Scalar in a range (but textual not numeric)

2004-02-26 Thread Richard Huxton
;ORDER BY pr_min DESC LIMIT 1) Aha! I was trying something like that, but couldn't get it quite right and it was getting too late for me to see clearly. Thanks Tom, I'll have a play with this later today. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] updating remote database

2004-02-26 Thread Richard Huxton
he replication options available - you may be able to adapt contrib/dbmirror, or perhaps erserver/rservimp on gborg.postgresql.org -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregist

Re: [SQL] oracle decode()

2004-03-03 Thread Richard Huxton
onal functions/operators iirc). -- Richard Huxton Archonet Ltd ---(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

Re: [SQL] sub-select parameter problem

2004-03-04 Thread Richard Huxton
olumn. ... ( SELECT x.field2 FROM tableB AS x WHERE x.field1 = tableB.field1 - 1 ) ... HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] Functional index and string concatenation

2004-03-08 Thread Richard Huxton
tion. Yes - a wrapper function is the standard solution. I don't think you need to do this in 7.4 though. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate su

Re: [SQL] currval() without specifying the sequence name

2004-03-09 Thread Richard Huxton
r(10)); > insert into someOthertest (value) values ('100'); > insert into test (value) values ('10'); > insert into test (value) values ('20'); > > select currval() should returns 2 (the last value of the test table > sequence) Not really - what

Re: [SQL] bytea or blobs?

2004-03-09 Thread Richard Huxton
g will convert back/fore quite neatly. Alternatively, you might prefer 'base64' - on average a less compact format I'd guess. I don't know whether the ECPG interface lets you pass "raw" binary back and fore or not, but hopefully someone else will. -- Richard H

Re: [SQL] changing constraints

2004-03-10 Thread Richard Huxton
ee a $2 constraint so why am i getting the error msg? Firstly, $2 will be the automatically created name for this new constraint. Secondly || doesn't mean OR - it joins strings. Try something like (untested): ALTER TABLE genus ADD CONSTRAINT valid_gender CHECK (gender IN ('masculine'

Re: [SQL] SQL query --- big question???

2004-03-12 Thread Richard Huxton
ease if it is not possible please say. You're best doing this in the application really. However, if you only want to work with text, search the mailing list archives using keywords like: text concat aggregate and you should see an example solution where you build your own aggregate

Re: [SQL] Line length in pl/pgsql function

2004-03-17 Thread Richard Huxton
.x Might be worth a quick look in the -bugs list archives and see if anything looks like your problem. -- Richard Huxton Archonet Ltd ---(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] function definition documentation

2004-03-23 Thread Richard Huxton
of your problems are down to quoting issues and misleading error statements. -- Richard Huxton Archonet Ltd ---(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

Re: [SQL] plpgsql vs. SQL in stored procedures

2004-03-31 Thread Richard Huxton
ke there you were using transact-sql (if I remember its name correctly) rather than sql. The syntax is different (plpgsql bares a startling resemblance to the Oracle approach), the purpose of each is the same. -- Richard Huxton Archonet Ltd -

Re: [SQL] partial unique constraint

2004-04-06 Thread Richard Huxton
if there is any way to do this in one of the later SQL standards? The CREATE INDEX thing is a bit of a hack, and I certainly wouldn't have thought of it either. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Encoding and result string length

2004-04-08 Thread Richard Huxton
rs, > irrespective of the values of c1 ranging from 100 to 10 million You could write such a coding so long as you don't mind having ten-thousand characters in your character-set. Of course, character does not equal byte like this, but that's true in the various unicode syste

Re: [SQL] cursors and for loops?

2004-04-13 Thread Richard Huxton
lts I think I should be getting. Is there > any kind of debug setting, or if not that, a way to output text (i.e. > printf) from plpgsql? RAISE NOTICE ''var1 = %, var2 = %'', var1, var2; Note - you need this format, you can't mix and match expressions etc. -- R

Re: [SQL] [GENERAL] SQL script

2004-04-15 Thread Richard Huxton
dump, a specific table/query? Do you need to provide values for this update/insert, or is it fixed (updating timestamps sort of thing). -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 9: the planner will ignore your desir

Re: [SQL] run application from trigger?

2004-04-17 Thread Richard Huxton
the procedural language pl/sh - I think that is what you need. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] rule's behavior with join interesting

2004-04-22 Thread Richard Huxton
E a.other_acc = OLD.acc; Your second example just ignored the OLD.acc altogether in the join, so of course you got an unconstraind join of 213 x 213. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Select from two databases

2004-04-22 Thread Richard Huxton
why this won't work in your case? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] Trigger calling a function HELP ME! (2)

2004-04-22 Thread Richard Huxton
n (other than as NEW.col1, NEW.col2, NEW.col3 etc). You can however use TG_NAME or TG_RELNAME to see what trigger/table called you. I find that's helpful. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] SUM() & GROUP BY

2004-05-07 Thread Richard Huxton
the question please do assist. Martin - you'll need to explain exactly what you want. Can you show what outputs you would like given the above data? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: you can get off all lis

Re: [SQL] SUM() & GROUP BY

2004-05-07 Thread Richard Huxton
| 5 SELECT d.divisions_name, s.pd_geo, COUNT(s.pd_geo) FROM ser_divisions d, ser s WHERE d.divisions_id = s.ser_divisions GROUP BY d.divisions_name, s.pd_geo ORDER BY d.divisions_name, s.pd_geo ; It's called a join, and any good SQL book should cover it. -- Richard Huxton

[SQL] Test - please ignore

2004-05-05 Thread Richard Huxton
Please ignore - testing a previously misconfigured email client -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Customised Encoding

2004-04-27 Thread Richard Huxton
that in Postgres SQL Server. You could use unicode (e.g. UTF-8) encoding. I don't see what it gains you though. What do you hope to achieve by storing numerical data as characters? -- Richard Huxton Archonet Ltd ---(end of broadcast)--

Re: [SQL] Proper SQL syntax requested

2004-04-27 Thread Richard Huxton
This is called a join. Any book on databases/SQL should discuss this sort of stuff. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] Customised Encoding

2004-04-27 Thread Richard Huxton
bytea,'UTF-8') > ERROR: No such encoding as 'UTF-8' I think you're using the encode() function wrongly. The second parameter is supposed to be something like "base64" or "hex". I'm not sure it makes sense to try and cast an integer

Re: [SQL] query optimizer dont treat correctly OR

2004-04-27 Thread Richard Huxton
it will get back compared to how many it actually gets back. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Max Columns in a SQL Select

2004-05-17 Thread Richard Huxton
for PostgreSQL. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[SQL] Using "Without OIDs"

2004-05-18 Thread Richard Huxton
nt OIDs that table will use 4 bytes less for every row, and so be a bit faster. I believe in the next version, the default setting will be not to have OIDs and you will have to specify "WITH OIDS" if you do want them. HTH -- Richard Huxton Archonet Ltd ---(end

Re: [SQL] Function valid only for one table

2004-05-19 Thread Richard Huxton
to do? -- Richard Huxton Archonet Ltd ---(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

Re: [SQL] v7.2 triggers and foreign keys

2004-05-21 Thread Richard Huxton
also deleted the a table row. You'll need to show the table definitions (with foreign keys etc) and also trigger definitions (use "\d table_a" in psql or "pg_dump --schema-only -t tablename") -- Richard Huxton Archonet Ltd ---

Re: [SQL] XML data field

2004-05-21 Thread Richard Huxton
the source folder. Haven't used them myself, so can't say more. Worth checking the mailing list archives though, since there has been discussion of this. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 7: don't for

Re: [SQL] UNIQUE columnt depdening on other column???

2004-06-02 Thread Richard Huxton
ut only for those columns that have active='y'. For the columns that have active='f' I don't care if num is unique or not. I'm asking this because num will be doubled some times. Non-standard but elegant: CREATE UNIQUE INDEX my_partially_unique_index ON rekl

Re: [SQL] bytea or blobs?

2004-06-03 Thread Richard Huxton
archives (this list and general would be a good start) for plenty of discussion on these. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unreg

Re: [SQL] Date format problems

2004-06-03 Thread Richard Huxton
me serial message_id column that should act as a clue. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Compiling pl/pgsql functions

2004-06-05 Thread Richard Huxton
t any of my PL/SQL functions (or yours) are so brilliant > that they need trade secret protection. Some of mine are so ugly, I wish they were hidden away mind you ;-) -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you

Re: [SQL] Last insert id

2004-06-09 Thread Richard Huxton
ur current connection. -- Richard Huxton Archonet Ltd ---(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

Re: [SQL] returning a recordset from PLpg/SQL

2004-06-09 Thread Richard Huxton
datatype inside your function. Clearly PostgreSQL needs to know what type is being returned while parsing the function, so you can't have a "dynamic type" (if such an idea has any meaning at all). -- Richard Huxton Archonet Ltd ---(end of broadcast)---

Re: [SQL] Triggers

2004-06-09 Thread Richard Huxton
this. I'd guess you dropped/recreated the function after defining the trigger, yes? The solution in older versions is to put the CREATE FUNCTION and CREATE TRIGGER in the same file so that you drop/recreate both together. HTH -- Richard Huxton Archonet Ltd ---(end of

Re: [SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Richard Huxton
views? At least for simple views of the kind 'CREATE VIEW v AS SELECT a,b,c FROM t'? If you're running 7.4 you can look in the information schema, in view_column_usage - that will tell you which table-columns a view uses. -- Richard Huxton Archonet Ltd ---

Re: [SQL] Function returns error

2004-06-10 Thread Richard Huxton
t myself on occasion. The '==' operator doesn't exist in plpgsql, you should use '=' when comparing and ':=' for assignment. HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] query with =ALL

2004-06-14 Thread Richard Huxton
ght well interfere (though I admit I haven't looked in detail) -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Is there a faster way to do this?

2004-06-15 Thread Richard Huxton
h a clever idea involving a join against a set-returning function, but I'm not sure about guaranteeing the order of the join vs the returned set (and it's getting late here). Any ideas people? Maybe one of those is some use -- Richard Huxton Archonet Ltd ---

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread Richard Huxton
igh key to t1). So there's no connection between column "code" in any of the tables? I'm confused as to the correlation between t0 and t1. I'm also not clear what t2.code is supposed to be. Could you give a short (5 rows each) example of the contents of the tables and th

Re: [SQL] Strange behaviour updating primary key column.

2004-06-21 Thread Richard Huxton
nd usually given is to do two updates: UPDATE story SET id = -id; UPDATE story SET id = -id + 1500; The real solution would be to check unique constraints at the end of statement, but I assume this is a tricky change or it would have been done by now. -- Richard Huxton Arch

Re: [SQL] Function Parameters - need help !!!

2004-06-21 Thread Richard Huxton
about it's type-matching, which is why you need to have two entries for the function. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Richard Huxton
te field1/2/3 then this won't work. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] matching rows differing only by fkey,pkey

2004-06-22 Thread Richard Huxton
bid. However, writing a perl script or plsql function to do this for you shouldn't be difficult. Screams out plpgsql to me - it's good at automating what is basically cut & paste of values. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] sql

2004-06-23 Thread Richard Huxton
co,clo1,nl,l1,m1; -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] feature request ?

2004-06-25 Thread Richard Huxton
as IF NOT((...)=false) is a good one. Handling of NULLs causes a great deal of pain to inexperienced and experienced developers alike. You might be interested in the archives at http://www.dbdebunk.com/ which IIRC contains some articles arguing against nulls at all in a relational system. -- Ri

Re: [SQL] Normalising an existing table - how?

2004-06-25 Thread Richard Huxton
data to an already partially normalised database. How can newtable contain data if you don't have any keys for it? Perhaps a fuller example, with the schemas of the tables in question would help. -- Richard Huxton Archonet Ltd ---(end of broa

Re: [SQL] feature request ?

2004-06-25 Thread Richard Huxton
lls. The key point of argument, and where the problem is with your (13 < NULL)::BOOL point is this: IT IS NOT MY PROBLEM !!! it is an EXAMPLE WHY WE CAN NOT PROHIBIT NULLS !!! Umm - who is suggesting prohibiting nulls? I've re-read the entire thread and can't find any such suggesti

Re: [SQL] Normalising an existing table - how?

2004-06-25 Thread Richard Huxton
the money_ref in old_money and then INSERT...SELECT to make sure you get the reference right in new_money. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Why no exprs in format string to RAISE

2004-07-05 Thread Richard Huxton
extreme. Might make a good project for someone learning more about PG's code. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's dataty

Re: [SQL] Triggers - need help !!!

2004-07-07 Thread Richard Huxton
s. IF OLD.CreateTime <> NEW.CreateTime THEN ... -- Richard Huxton Archonet Ltd ---(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] Inserts with incomplete rows... NOT NULL constraints

2004-08-11 Thread Richard Huxton
t want to provide a value you'll need to set a DEFAULT. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Sending errors from psql to error file

2004-08-12 Thread Richard Huxton
rep "ERROR:*" > import_errors Try something like: ... psql cli_post 2>import_errors STDOUT is file-handle 1, STDERR is file-handle 2. You might also want to read up on the "tee" utility. -- Richard Huxton Archonet Ltd ---(end of broadcast)

Re: [SQL] duplicate table in two databases

2004-08-16 Thread Richard Huxton
ook in the contrib/ folder of the source distribution (or the equivalent in your packaged installation for "dblink". Haven't used it myself, but it can certainly do what you want here. -- Richard Huxton Archonet Ltd ---(end of broadcast)-

Re: [SQL] CROSS-TAB query help? I have read it cant be done in one

2004-08-16 Thread Richard Huxton
| | | 100473 | | | text1| | Don't forget the provided crosstab functions (in contrib/). If you don't want that, you could aggregate your results: SELECT content_object_id, MAX(xpos), MAX(ypos), ... FROM ( ) AS raw GROUP BY content_object_id; -- Rich

Re: [SQL] CROSS-TAB query help? I have read it cant be done in on

2004-08-17 Thread Richard Huxton
| | | 100473 | | | text1| | -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unreg

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-17 Thread Richard Huxton
mented with an index, so I'm guessing the FK code assumes there is an index there to check against. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Richard Huxton
ybe an alternative todo? * Allow multiple unique constraints to share an index where one is a superset of the others' columns. That way you can mark it unique without having the overhead of multiple indexes. -- Richard Huxton Archonet Ltd ---(end o

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Richard Huxton
presumably that's already implied. -- Richard Huxton Archonet Ltd ---(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] multi column foreign key for implicitly unique columns

2004-08-20 Thread Richard Huxton
d) WHERE trans_type='CHQ'; Actually, since we can have a "unique index with where" this second form should be do-able shouldn't it? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our exte

Re: [SQL] pg_dump/pg_restore question

2004-08-23 Thread Richard Huxton
ust Or, since you're on 7.2 probably local all trust HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] stored procedures and type of returned result.

2004-08-24 Thread Richard Huxton
o's set-returning-functions article on techdocs. http://techdocs.postgresql.org/guides/SetReturningFunctions HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

Re: [SQL] stored procedures and type of returned result.

2004-08-24 Thread Richard Huxton
T SELECT lsttable(); -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Problem with stored procedure

2004-08-26 Thread Richard Huxton
Key (typnum)=(43) is not present in table "types". I don't kown why. Before your "insert into" add: RAISE NOTICE ''cletype = %'', cletype; This will show what value cletype has. Presumably it's 43 and you don't have an equivalent row in &

Re: [SQL] Problem with returning setof record

2004-09-07 Thread Richard Huxton
opriate table you can use CREATE TYPE to create a structure. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Query Plan

2004-09-09 Thread Richard Huxton
ry but 150 in the second then it might decide a sequential scan is quicker. Post the outputs of explain analyse and we can compare them. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list ar

Re: [SQL] SQL doubt - Date Add

2004-10-11 Thread Richard Huxton
ichardh=# SELECT '2004-02-29'::date + '1 year'::interval; ?column? - 2005-02-28 00:00:00 (1 row) richardh=# SELECT '2004-02-29'::date + '4 years'::interval; ?column? - 2008-02-29 00:00:00 (1 row)

Re: [SQL] Plperlu function & backticks return value -> truncated?

2004-10-13 Thread Richard Huxton
- -- TYPE: line_type CREATE TYPE public.line_type AS ( line text ); CREATE FUNCTION public.show_users() RETURNS SETOF user_type AS user_rec line_type%ROWTYPE; -- Richard Huxton Archonet Ltd

Re: [SQL] Ordering a record returned from a stored procedure - date

2004-10-19 Thread Richard Huxton
Org Subject: Re: [SQL] Ordering a record returned from a stored procedure - date issue I have the code working except for the date part of the where clause. Can anyone point out how yield_date = ''''10/18/2004'''' can be translated so the 10/18/2004 is comin

Re: [SQL] SQL update function faililed in Webmin Interface

2004-10-20 Thread Richard Huxton
t;name" (look carefully at the error message). If you quote the name when you create it, ALWAYS quote it. If you never quote names then you won't have any problems. It might be that the webmin module quoted the column-name for you without your knowledge. You'll need to consult

Re: [SQL] Join Table

2004-11-01 Thread Richard Huxton
one of the PK columns? CREATE TABLE SUPPLY ( ITEM_FK integer NOT NULL, CONTACT_FK integer NOT NULL, COST numeric (7,2), PRIMARY KEY (ITEM_FK,CONTACT_FK) ); The primary-key index can be used for ITEM_FK but not CONTACT_FK, so you might want an index on that column. -- Richard Huxton Archonet

Re: [SQL] Error In connection ??

2004-11-10 Thread Richard Huxton
254" 2004-11-10 11:22:47 FATAL: missing or erroneous pg_hba.conf file 2004-11-10 11:22:47 HINT: See server log for details. Configuration file pg_hba.conf hostall all 192.168.2.1/254 md5 You don't have 254 bits in in IP address. Did you mean /32? -- Rich

Re: [SQL] Error In connection ??

2004-11-10 Thread Richard Huxton
for a network howto on CIDR subnet formats. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Unicode problem inserting records - Invalid UNICODE character

2004-11-10 Thread Richard Huxton
quot; in the "Localization" chapter of the manuals) -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] Unicode problem inserting records - Invalid UNICODE character

2004-11-12 Thread Richard Huxton
contains four accented characters, with accents as follows: A` E` D- O/ Actually, this doesn't display properly in my usual terminal (konsole under KDE) but does under xterm. -- Richard Huxton Archonet Ltd CREATE TABLE foo (t text); -- DELETE FROM foo; COPY foo FROM STDIN; AAA À È Ð Ã

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
a while. The only thing is, you need to remember to call nextval() every time you connect. HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
Achilleus Mantzios wrote: O Richard Huxton έγραψε στις Nov 17, 2004 : Riccardo G. Facchini wrote: hi all, is there a way to determine the session id on a database session? I would need to have a unique number whenever a session is started, and have this available as a function or view result

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
to also change my_session_id to another value. No - other sessions will see different values. Test it and see. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscrib

Re: [SQL] get sequence value of insert command

2004-11-19 Thread Richard Huxton
ned to him? :-) -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] transactions in functions, possible bug or what I'm doing

2004-11-19 Thread Richard Huxton
oints" in version 8.0 though, which lets you trap errors and rollback to a named (saved) point in your function. -- Richard Huxton Archonet Ltd ---(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

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Richard Huxton
rrect procedure (although ask yourself if you should have nulls rather than just empty strings). -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] tutorials for complex.sql & complex.c

2004-11-26 Thread Richard Huxton
the source distribution (.tar.gz or .bz2) - the one you'd use to compile PostgreSQL from scratch. Untar it, and you'll see src/tutorial directories. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 9: the planner will i

Re: [SQL] count record in plpgsql

2004-11-29 Thread Richard Huxton
tus"). HTH -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] grouping a many to many relation set

2004-11-30 Thread Richard Huxton
; row. Maybe someone smarter than me can come up with a non-procedural solution. Personally, I've got a nagging feeling that this sort of "connectedness" problem is NP, so scaling could be a problem for you. -- Richard Huxton Archonet Ltd ---(end of broa

Re: [SQL] session-wide autocommit off

2004-11-30 Thread Richard Huxton
? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] SET AUTOCOMMIT TO OFF

2004-12-02 Thread Richard Huxton
." 4. Issue "UPDATE..." 5. Issue "INSERT..." 6. etc Until you issue COMMIT/ROLLBACK the transaction remains open. If you had an error at step 3, then 4,5 would fail because the transaction would be aborted (but waiting for you to issue ROLLBACK).

Re: [SQL] order by problem

2004-12-02 Thread Richard Huxton
uot;C" sorting, so dump your database, re-initdb with --locale=C and restore the dump. There's a whole chapter on localisation in the manuals. Make sure you are clear on the difference between encoding and locale. -- Richard Huxton Archonet Ltd ---(e

Re: [SQL] mysql set datatype

2004-12-13 Thread Richard Huxton
hould be straightforward enough to write some support functions and just use a text type, but that'd use a lot more storage. Of course, another table is the accepted way of doing this relationally. Are there any particular features you need, or are you just porting an application fr

Re: [SQL] can't get the order I want after inserting new rows

2004-12-17 Thread Richard Huxton
summarise, and if so by what? Can you explain how you would do this by hand. Could you provide the actual table definition? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] can't get the order I want after inserting new rows

2004-12-17 Thread Richard Huxton
er_score DESC, t1.part ASC; Write a small plpgsql function to process the table in that order and update "full" accordingly. Actually, I'd add a SERIAL primary key and have a separate table for "full" - that way you can just delete the sorting values and replace them in one

Re: [SQL] Hide schemas and tables

2004-12-13 Thread Richard Huxton
relations from beeing seen. Obviously, everyone needs access to the system tables and at present there is no system in place to restrict access to viewing all their contents. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 3: if

Re: [SQL] [Fwd: Majordomo results: unsubscribe]

2004-12-15 Thread Richard Huxton
alias for this account is [EMAIL PROTECTED] Both may be listed because I frequently get emails in duplicate. Any help would be greatly appreciated. Try the web interface from http://www.postgresql.org/lists.html - you can unsubscribe/get a password reminder from there. -- Richard Huxton Arc

<    1   2   3   4   5   6   7   8   9   >