Re: [SQL] Format interval as hours/minutes etc

2007-09-17 Thread Oliver Elphick
lengths.) Is there any plan to support that? -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ===

[SQL] Re: [NOVICE] Install two different versions of postgres which should run in parallel

2007-08-10 Thread Oliver Elphick
to see how it works. If you can't do that, you can install a different version from source in a different directory tree; then have its postmaster run on a different port. Specify the port number when connecting so as to get to the postmaster you want. -- Oliver Elphick

Re: [SQL] DEFAULT Constraint based on table type?

2005-11-29 Thread Oliver Elphick
On Tue, 2005-11-29 at 10:31 +, Oliver Elphick wrote: > SELECT tableoid::regproc, * from animals; regproc should be regclass; sorry. -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 10

Re: [SQL] DEFAULT Constraint based on table type?

2005-11-29 Thread Oliver Elphick
verriding a > constructor or method, using the Class object or instanceof. Is there > anyway for a table to "know" it's "class" in this scenario? SELECT tableoid::regproc, * from animals; -- Oliver Elphick olly@lfix.co.u

Re: [SQL]

2005-11-24 Thread Oliver Elphick
var VARCHAR; BEGIN var := TG_ARGV[0]; IF var = 'column_1' THEN NEW.column_1 = 'whatever'; ELSIF var = 'column_2' THEN NEW.column_2 = 'whatever'; ... END IF; RETURN NEW; END; $$ LANGUAGE plpgsql; Oliver Elphick ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] pg_dump

2005-11-15 Thread Oliver Elphick
el to use in archive formats that -support compression. (Currently only the custom archive -format supports compression.) +support compression. (Currently the tar archive +format does not support compression. The plain text format is +compressed with gzip.)

Re: [SQL] can not connect to pg on linux FC4

2005-11-08 Thread Oliver Elphick
uestion. Is there a way that I can create a > user using password authetication at the situation I > have no pg account like this sitation?. Assign a password for the user with ALTER USER. Then add a suitable line to pg_hba.conf. Oliver Elphick ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Problem while using start transaction ans commit;

2005-10-19 Thread Oliver Elphick
You cannot start or commit a transaction inside a function. You can use savepoints. -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC

Re: [SQL] Query information needed

2005-10-19 Thread Oliver Elphick
l) and calculate the average > duration. For any particular interval: SELECT COUNT(*), AVG(duration) FROM cdr WHERE src='601' AND calldate BETWEEN CAST ('2005-10-17 10:00:00' AS TIMESTAMP WITH TIMEZONE) AND

Re: [SQL] Group by and aggregates

2004-11-04 Thread Oliver Elphick
b.partno = a.partno) as cmup, sum(qty) from my_table as a group by partno, status, (select max(cmup) from my_table as b where b.partno = a.partno); partno | status | cmup | sum +--+---+- test1 | incoming | 15.00 | 71 test1 | stock | 15.00 | 15 test2 | incoming | 1

Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Oliver Elphick
On Tue, 2004-10-26 at 17:43 -0400, Tom Lane wrote: > Oliver Elphick <[EMAIL PROTECTED]> writes: > > On Tue, 2004-10-26 at 14:23 -0500, Yudie wrote: > >> Then I do this query to get unique store number and also the cheapest > >> price from each store: &g

Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Oliver Elphick
the query that returns as above but sorted > by price? The literal answer to your question is to put price first in the ORDER BY clause, but I'm not convinced you actually want to know something that simple. -- Oliver Elphick [EMAIL PROTECTED] Isle

Re: [SQL] problems using phpPgAmin

2004-10-18 Thread Oliver Elphick
e postmaster afterwards to get it to reload the settings? > Are there any other admin tools out there that > i could use on a a unix box? pgadmin3 -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk

Re: [SQL] Isnumeric function?

2004-09-08 Thread Oliver Elphick
inelegant to me. Is there a regex expert in the > house? All the elegant approaches I can think of match the empty string. There must be at least one digit and 0 or 1 decimal point with no other characters permitted. If you use this as a constraint, you c

Re: [SQL] Isnumeric function?

2004-09-08 Thread Oliver Elphick
before the decimal; it would be nice to adapt it to matching a leading > decimal (i.e. .057 ) as well. Can't see any easy way, though ... ~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$' -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight

Re: [SQL] Isnumeric function?

2004-09-06 Thread Oliver Elphick
~ '^[0-9]+$' Your version only checks the beginning of the string. > There must be an easier way like a isNumeric() function? Not that I know of. -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight http://www.lfix.co.u

Re: [SQL] Full access to a DB with a second user?

2004-09-05 Thread Oliver Elphick
nto the file /tmp/grant.sql as directd earlier. > > \o Stop sending output to the file. > > \i /tmp/grant.sql Run the output file as a script, thus granting the permissions to joe. -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight

Re: [SQL] Possible rounding error of large float values?

2004-08-24 Thread Oliver Elphick
ric can't produce any more than it was given and it was cast from float. bray=# select 653596708775675750507850507570708696432 ::numeric; numeric --------- 653596708775675750507850507570708696432 (1 row) -- Oliver Elphick

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

2004-08-19 Thread Oliver Elphick
could do would be to see the error. So he might as well turn it round, normalise the data properly and use the database to tell the rest of the system what the data ought to be. Oliver Elphick ---(end of broadcast)--- TIP 3: if postin

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

2004-08-17 Thread Oliver Elphick
? If there is no unique key, how does the foreign key trigger find the referenced row except by doing a sequential scan? Bad news! And when one of the duplicate referenced rows changes, what should happen with ON UPDATE or ON DELETE? -- Oliver Elphick

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

2004-08-15 Thread Oliver Elphick
On Thu, 2004-08-12 at 16:09, Oliver Elphick wrote: > "2>" redirects standard error I forgot to say "&1" means the file open on file descriptor 1, which is always standard output. So "2>&1" means send standard error to standard output, so that a pipe

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

2004-08-12 Thread Oliver Elphick
On Thu, 2004-08-12 at 16:01, Devin Whalen wrote: > > zcat cli_postDataInserts.sql.gz | > >psql -d cli_post -U system --echo-queries -f - >trace.file 2>&1 > > Just a few questions about your command. I tried it with one sql > statement that I know doesn't work and the error went into the right

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

2004-08-12 Thread Oliver Elphick
hich line in the input. zcat cli_postDataInserts.sql.gz | psql -d cli_post -U system --echo-queries -f - >trace.file 2>&1 Oliver Elphick ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

Re: [SQL] surrogate key or not?

2004-08-07 Thread Oliver Elphick
hange - id will never change. id is used as the foreign key It can change if you use ON UPDATE CASCADE in the foreign key definitions. -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024

Re: [SQL] Grouping by week

2004-08-06 Thread Oliver Elphick
is if I can shift the week from a Mon-Sun > articulation(default with Postgre) to a Sun-Sat sequence. I need it that way > in order to comply with a legacy stats system. How about: SELECT EXTRACT(WEEK FROM trans_date + '1 day'::INTERVAL) -- Oliver Elphick

Re: [SQL] next integer in serial key

2004-07-22 Thread Oliver Elphick
eturned to some other user's session. The downside is that it operates outside the transaction and therefore cannot be rolled back. It is also necessary to run nextval() in the session (either explicitly or by letting a serial column take its default) before you can use currval() on the seq

Re: [SQL] next integer in serial key

2004-07-21 Thread Oliver Elphick
On Thu, 2004-07-22 at 03:45, Kenneth Gonsalves wrote: > hi, > how does one get the next number in a serial type row? When inserting a new row, do not mention the serial column in the list of columns, or else give it the value DEFAULT. -- Oliver E

Re: [SQL] Inherited tables and new fields

2004-07-21 Thread Oliver Elphick
e code in the function, because it's expecting > all_drafts to look like draft_template, with editor_id added at the end. > > Is this a mis-feature? New columns get added at the end of each table; that is standard. -- Oliver Elphick [EMAIL PROTECT

Re: [SQL] How to avoid (stop) a endless loop in a trigger

2004-03-04 Thread Oliver Elphick
On Thu, 2004-03-04 at 14:54, Rodrigo Sakai wrote: > Hi people, i have a problem here. > I'm doing a trigger that when a update occurs i need to do an update on the same > table (target table), but as known, it causes a endless loop whithin infinit > updates. So I need to stop the trigger af

Re: [SQL] SYSDATE in PostgreSQL !?

2004-03-01 Thread Oliver Elphick
On Mon, 2004-03-01 at 21:18, Louie Kwan wrote: > How can I define a table with columns with sysdate as the default value.. > > If there is no SYSDATE defined in PostgreSQL , what can I do ? > CREATE TABLE channels( ... > updateTimeStamp DATE default (SYSDATE), > createTimeStamp D

Re: [SQL] SUM() & GROUP BY

2003-09-28 Thread Oliver Elphick
GROUPed or used in an > aggregate function > hotel=# > > What Worng ?? Any items in the select list need to be aggregated (e.g. SUM("public".items.price)) or mentioned in the GROUP BY list. Suppose there are several

Re: [SQL] Sequenties in pgSQL 7.3.x

2003-09-25 Thread Oliver Elphick
m drop the table, do > modification and i'm must change this value to another value. > But DBMS returns me message like that > ERROR: You can't change sequence relation seq_id_seq > How to do this Use the setval() function? -- Oliver Elphick

Re: [SQL] auto_increment

2003-09-19 Thread Oliver Elphick
On Sat, 2003-09-20 at 06:10, Muhyiddin A.M Hayat wrote: > How to Create auto_increment field in PostreSQL. > Can I create them using Trigger. Use the SERIAL datatype. See also the functions nextval(), currval() and setval(). -- Oliver Elphick[EMAIL PRO

Re: [SQL] psql output and password Qs

2003-09-19 Thread Oliver Elphick
n messages. Standard output and standard error are different streams. The normal way to do what you want (Bourne shell syntax) is: psql ... >outfile 2>&1 > 2) When psql is run from a script, how would one pass a password to psql? Create a .pgpass file to read it from (see the

Re: [SQL] Column Types

2003-09-14 Thread Oliver Elphick
On Sun, 2003-09-14 at 07:49, Muhyiddin A.M Hayat wrote: > If in MySQL i'm using type EMUN what type in Postgres? Use a CHECK constraint: CREATE TABLE xxx ( ... colourTEXT CHECK (colour IN ('red', 'green', 'blue')), ... ); -- Oliver Elphick

Re: [SQL]

2003-02-02 Thread Oliver Elphick
support this -it > seems you can only have one return value or null. > > Yes i'm aware this it is possible in 7.3 - can someone please confirm > its not possible in 7.2 or provide me with an example of how to go > about it. Not possible in 7.2 PL/pgSQL

Re: [SQL] COPY use in function with variable file name

2003-02-02 Thread Oliver Elphick
x27; || r.domain; > DELETE FROM dns_raw; /* Clear table */ > RAISE NOTICE ''Network: %'', ntw; > COPY dns_raw FROM ntw DELIMITERS ''~''; /* Get the data */ Since ntw has variable content, you need to do an EXECUTE with the command in a text str

Re: [SQL] Function for adding Money type

2003-01-26 Thread Oliver Elphick
the ability to specify the number of decimal places > on output but I am not sure if that would affect the primary benefit of using > it, speed. A money type needs to specify what currency is held. The current one changes the currency with the locale, which makes nons

Re: [SQL] Password user postgres

2002-12-22 Thread Oliver Elphick
t;, meaning that you can connect using your Unix login name, provided that user has also been created as a PostgreSQL user. The PostgreSQL superuser is 'postgres'. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfi

Re: [SQL] is numeric relational operator problem fixed in v7.3

2002-12-10 Thread Oliver Elphick
On Wed, 2002-12-11 at 02:54, jack wrote: > Does the following now works in postgreSQL v7.3? > > Select * > from a_table > where num1 >10; > > *** type of num1 is NUMERIC (12,2) It works -- Oliver Elphick <[EMAIL PROTECTED]> LFIX Limited --

Re: [SQL] Problem with a lookup table! Please help.

2002-12-09 Thread Oliver Elphick
gainst_anaerobes = e4.efficacy_code; Note that you must use double quotes to quote identifiers, not single quotes as you did in your table creation definitions, which won't work in PostgreSQL. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK

Re: [SQL] Problems invoking psql. Help please.

2002-11-20 Thread Oliver Elphick
On Wed, 2002-11-20 at 15:03, Tom Lane wrote: > Oliver Elphick <[EMAIL PROTECTED]> writes: > > execv() is a system call to run another executable in place of the > > current process. If the other executable is not present, or does not > > have permissions, you will not b

Re: [SQL] Problems invoking psql. Help please.

2002-11-20 Thread Oliver Elphick
/psql -d template1 -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C &q

Re: [SQL] Problems invoking psql. Help please.

2002-11-20 Thread Oliver Elphick
. Find out why. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "If

Re: [SQL] Problems invoking psql. Help please.

2002-11-20 Thread Oliver Elphick
nce you have just reinstalled the package. Is the file itself executable by all users? (Use "ls -l" to check this.) Has someone made an intermediate directory unsearchable? Every directory in its path should have search (i.e. execute) permission for all users. Check /usr, /

Re: [SQL] Problems invoking psql. Help please.

2002-11-18 Thread Oliver Elphick
Permissions on /usr/lib/postgresql/bin/readpgenv should be 755. How did they get unset? -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

Re: [SQL] Help with SQL

2002-10-16 Thread Oliver Elphick
y won't want any rows where count1 is null. If the total of rows from subselect c1 was likely to be less than 10, you might want to do a FULL JOIN and order by count1, count2. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://

Re: [SQL] how to cast this ?

2002-09-12 Thread Oliver Elphick
e and log_time and put it into > log_timestamp ? > > update log set log_timestamp = cast (log_date as timestamp) || cast > (log_time as timestamp) > > is not working. I don't know what format you have your dates and times in, but maybe this will work: CAST (log_date

Re: [SQL] Update Help

2002-09-03 Thread Oliver Elphick
SELECT price FROM table2 WHERE table1.product = table2.product); -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1

Re: [SQL] convert sum (interval) to seconds

2002-09-03 Thread Oliver Elphick
+ extract (second from sum(if)) from i; ?column? -- 2728 (1 row) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09

Re: [SQL] Separating data sets in a table

2002-08-26 Thread Oliver Elphick
On Mon, 2002-08-26 at 10:46, Andreas Tille wrote: > On 26 Aug 2002, Oliver Elphick wrote: > > > Select from the temporary table all items that satisfy the > > constraints, insert them into the real table and delete them from > > the temporary tabl

Re: [SQL] Separating data sets in a table

2002-08-26 Thread Oliver Elphick
tablename (SELECT * FROM temptable WHERE ...); DELETE FROM temptable WHERE ...; COMMIT; All good data should now be in place. The temporary table should now contain only those items that do not satisfy the constraints for the real table. -- Oliver Elphick

Re: [SQL] [ADMIN] How to execute my trigger when update certain columns

2002-08-21 Thread Oliver Elphick
7;'UPDATE'' AND (NEW.column1 != OLD.column1 OR (NEW.column1 IS NULL AND OLD.column1 IS NOT NULL) OR (NEW.column1 IS NOT NULL AND OLD.column1 IS NULL) ) ) THEN ... END IF; -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK

Re: [SQL] Few Queries

2002-08-14 Thread Oliver Elphick
gsql'; You don't seem to be returning what you have selected. I would expect "RETURN true;" to give you an error. Shouldn't that be "RETURN var_history_age_limit;"? -- Oliver Elphick[EMAIL PROTECTE

Re: [SQL] parser: parse error at or near "$1"

2002-08-14 Thread Oliver Elphick
tatus_log ( log_id, computer_id,schedule_id,status, schedule_id in the insert is a column name; the alias subsitutes $1 at that point. You had better choose variable names that don't conflict with anything else. -- Oliver Elphick[EMAIL PROTECTED] Isle of W

Re: [SQL] Another postgres 'file not found' error

2002-06-13 Thread Oliver Elphick
g about some bug with > Postgres on Debian, but I can't remember where I heard it. I do not think there is any Debian bug report that looks like this. The full bug list is at http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=postgresql -- Oliver Elphick[E

Re: [SQL] EXECUTE ... INTO?

2001-10-16 Thread Oliver Elphick
. FOR variable IN EXECUTE ''SELECT ...'' LOOP END LOOP; -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

Re: [SQL] Need help in composing PostgreSQL query

2001-09-04 Thread Oliver Elphick
p2 > s3 | p2 > s4 | p2 > s4 | p4 > s4 | p5 >(12 rows) > >For such tables our desired query should return: > > s > > s1 SELECT DOR.s FROM DEND,DOR WHERE DOR.p = DEND.p; -- Oliver Elphick[EMAIL PROTECTED]

Re: [SQL] GRANT ALL ON TO GROUP failure

2001-08-29 Thread Oliver Elphick
OUP user; user is a reserved word; it should not have been accepted as a group name unless double-quoted, in which case you need to double-quote it every time you mention it. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lf

Re: [SQL] left join syntax

2001-05-08 Thread Oliver Elphick
on_id = c.emp_id junk-# ORDER BY ordr_id; ordr_id | assigned | completion -+--+ 1 | | 2 | aaa | 3 | aaa | bbb 4 | | bbb (4 rows) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wigh

Re: [SQL] General ISA and Foreign Key

2001-05-07 Thread Oliver Elphick
istorique" and "filmDocumentaire" should have foreign key constraints on "film". You could maintain the contents of "film" by triggers on the other two tables. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight

Re: [SQL] PSQL 7.1 DEBS

2001-04-21 Thread Oliver Elphick
Mateusz Mazur wrote: >Hi. >Is there any place where can I find PSQL 7.1 Debian packages? http://people.debian.org/~elphick/postgresaql (7.1rc4) I'm working on final tweaks to packaging of 7.1 -- Oliver Elphick[EMAIL PROTECTED] Is

Re: [SQL] copy into serial field with auto_increment

2001-04-19 Thread Oliver Elphick
afterwards. If it is during COPY, edit your textfile and assign unique values to each row. If it is afterwards, use SELECT setval('sequence_name', SELECT max(serial_field) FROM table); to set the sequence value. (You probably have to be running 7.1 to use a sub-select like t

Re: [SQL] Dropping users with no name

2001-04-14 Thread Oliver Elphick
| 27 | f | f| f| f | > | >(2 rows) > >persons=# DELETE FROM pg_user where usesysid>26; >DELETE 0 pg_user is a view. Try DELETE FROM pg_shadow where usename = ''; -- Oliver Elphick

Re: [SQL] Debian Package problems

2001-04-13 Thread Oliver Elphick
ault. >>There's nothing pointed in the packages web pages, a caveat or >> anything. I've looked. > > Okay, I feel dumb now. > It looks like Oliver Elphick (the package maintainer) changed the >default authentication methods. Before local users

Re: [SQL] enumerating rows

2001-04-11 Thread Oliver Elphick
t any other database. Nor do I know if any other databases can accommodate user-defined functions. But what is the actual use of this feature? Why do you need it? -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/ol

Re: [SQL] enumerating rows

2001-04-11 Thread Oliver Elphick
ame ---++--- 6015 | 11 | Mr Graham Love (Director) 6016 | 12 | AILEEN BROWN ... #include "postgres.h" #include "fmgr.h" static int32 row = 0; PG_FUNCTION_INFO_V1(row

Re: [SQL] Concatenate fields

2001-04-11 Thread Oliver Elphick
bill_id; > >When it finds some empty field, it makes all the new field empty, no >matters >if the other are empty or not. In this case, empty means NULL. Any concatenation involving NULL returns NULL; this is according to the standard. Use COALESCE(fiel

Re: [SQL] problem with copy command

2001-04-11 Thread Oliver Elphick
nd line (the backslash will protect it from the shell). We copy the database out twice to ensure that all keys already in it are excluded, otherwise we would be reintroducing all primary keys that were _not_ in the desired input. The end product is a file that excludes all primary keys that

Re: [SQL] a select statement that sometimes joins

2001-04-10 Thread Oliver Elphick
, and include >information about an attachment if they have one" SELECT m.msg_id, a.attachment_id FROM messages AS m LEFT OUTER JOIN message-attachments AS a ON m.msg_id = a.msg_id; This requires 7.1 for the LEFT OUTER JOIN. In 7.0.3 you

Re: [SQL] searching for dates

2001-04-04 Thread Oliver Elphick
me the years between >1990 and 2001 or some >othere set of dates. > >I would realy like to be able to just have a function to tell me if a >date in my datebase is >befor or after a date? SELECT * FROM table WHERE start_date BETWEEN 

Re: [SQL] PIVOT of data

2001-03-14 Thread Oliver Elphick
ELECT location, CASE WHEN marketing = 'NEWS' THEN numbrochures ELSE NULL END AS "NEWS", CASE WHEN marketing = 'TV' THEN numbrochures ELSE NULL END AS "TV", ... but it's a

Re: [SQL] need to join successive log entries into one

2001-03-14 Thread Oliver Elphick
ented language that can't do this sort of thing without some appalling contortions, if at all. (I can't think of a way to do it.) So, store the data in PostgreSQL, but do procedural processing in a more appropriate language. -- Oliver Elphick[EMAIL PROTE

[GENERAL] Re: [SQL] Permissons on database

2001-03-06 Thread Oliver Elphick
Boulat Khakimov wrote: >Hi, > >How do I grant permissions on everything in the selected databes? > >GRANT doesnt take as on object database name nor does it accept wild >chars However you can give it a list of tables (and other objects).

Re: [SQL] int2+float8 problems

2001-02-28 Thread Oliver Elphick
> >what to get -7678 This works in 7.1beta4. Perhaps you need to upgrade. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 102

Re: [SQL] sum(bool)?

2001-02-26 Thread Oliver Elphick
Olaf Marc Zanger wrote: >hi there, > >i want to add up the "true" values of a comparison like > >sum(a>b) > >it just doesn't work like this > >any workaround? select count(*) where a > b; -- Oliver Elphick

Re: [SQL] logging a psql script

2001-02-21 Thread Oliver Elphick
Ken Kline wrote: >Hello, > I would like my psql script to log everything that it does. psql -e -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47

Re: [SQL] createuser problem

2001-02-14 Thread Oliver Elphick
ve this problem? Become user postgres before you try to run createuser. (Or become any user who has create user privilege.) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 7

Re: [SQL] Is this feature a bug?

2001-01-30 Thread Oliver Elphick
Christopher Sawtell wrote: >Is the "( 1 row)" string really supposed to be there? >imho it should not be. >How can I turn it off? \pset tuples_only or \t or start psql with the -t option. -- Oliver Elphick[EMAIL PROTE

Re: [SQL] DROP Column

2001-01-30 Thread Oliver Elphick
Keith Gray wrote: >Is DROP Column implemented in 7.x? No -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: C

[SQL] Re: [HACKERS] How to modify type in table?

2001-01-30 Thread Oliver Elphick
"Jaruwan Laongmal" wrote: >Would you like to inform me how to modify type in table? >For example , I define type as varchar(14) , but I want to modify to varcha= >r(120). How to do this. There is no facility to do this directly. (Allowing columns to change their type would possibly involve

Re: [SQL] Don't want blank data

2001-01-25 Thread Oliver Elphick
_ip FROM computers; COALESCE() returns the leftmost non-null value from its parameters. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C

Re: [SQL] Is there anything like DESCRIBE?

2001-01-25 Thread Oliver Elphick
pport DESCRIBE... is there any other way to do this? If you run psql with the -E option, it will show you the query it uses when you type `\d+`. Use that query in your procedural code. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight

Re: [SQL] "'" in SQL INSERT statement

2001-01-25 Thread Oliver Elphick
a (b) values ('Fred\'s text'); INSERT 6815937 1 junk=# select * from a; a | b ---+----- 1 | some text 2 | John's text 3 | Fred's text (3 rows) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight htt

Re: [SQL] DATE

2001-01-24 Thread Oliver Elphick
rmat you are using, but in standard SQL: template1=# select CURRENT_DATE as now, template1-#CAST (CURRENT_DATE + INTERVAL '7 days' AS DATE) as week; now |week + 2001-01-24 | 2001-01-31 (1 row) Use to_char() for date formatting. -- Oliver

Re: [SQL] Where can i get Pgaccess

2001-01-19 Thread Oliver Elphick
Ramesh H R wrote: >Hello everyone, >Please can anyone tell me, where i can get Pgaccess query tool It is in the PostgreSQL source at src/bin/pgaccess/ See also http://www.flex.ro/pgaccess -- Oliver Elphick[EMAIL PROTECTED] Isle of

Re: [SQL] Postgresql database access

2001-01-05 Thread Oliver Elphick
select * from X.table > >This causes a parse error. What's the correct sintax? It isn't possible to do this; you can only look at one database at a time. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://w

Re: [SQL] psql -f option

2001-01-04 Thread Oliver Elphick
QL queries echoed; then you can see where the errors are arising. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C:

Re: [SQL] References to SERIAL

2000-12-30 Thread Oliver Elphick
ent to look up the newly-created row from the table: bray=# insert into junk (name) values ('Fred'); INSERT 1780993 1 bray=# select * from junk where oid = 1780993 ; id | name +-- 1 | Fred (1 row) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight

Re: [SQL] How to trim values?

2000-12-28 Thread Oliver Elphick
tal number of digits, and 2 is two decimal places). template1=# select 3.68009074974387::numeric(3,2); ?column? -- 3.68 (1 row) or use round(value,2) template1=# select round(3.68009074974387, 2); round --- 3.68 (1 row) -- Oliver Elphick

Re: [SQL] Invoice number

2000-12-21 Thread Oliver Elphick
ers. Not necessarily exactly sequential numbers. For invoice numbers, it matters. Numbers missing from such a sequence are likely to provoke questions from auditors and taxmen; why borrow trouble? -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight

Re: [SQL] plpgsql

2000-12-12 Thread Oliver Elphick
dural languages. create function plpgsql_call_handler() returns opaque as '/usr/local/pgsql/lib/plpgsql.so' <-- or wherever language 'C'; create trusted procedural language 'plpgsql' handler plpgsql_call_handler lancompiler 'PL/pgSQL'; --

Re: [SQL] is there a debian package for plperl?

2000-11-29 Thread Oliver Elphick
y could point on on where to search for it... plperl failed to build in 7.0.2; however, I have just built 7.0.3-1 and plperl.so is now included again. This should be uploaded within the next day or so. -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight

[SQL] Can I use subselect as a function parameter?

2000-10-11 Thread Oliver Elphick
parser accepts it, but when it is run on a line that matches the ELSE in the constraint, I get: copy product from '/usr1/avoca/dumps/dbdump.product' ERROR: copy: line 2, ExecEvalExpr: unknown expression type 108 Can this be made to work at all (in 7.0.2)? -- Oliver Elphick

Re: [SQL] Classes, Inheritance, and Children

2000-07-27 Thread Oliver Elphick
-- specify first to establish the -- column types union select id, null, null from foo union select id, name, null from bar1 union select id, null, data from bar2; Unfortunately, you can't make this a view, because views of unions are not

Re: [SQL] CREATE TABLE with foreign key and primary key

2000-07-10 Thread Oliver Elphick
t null, -- not null here local_prova varchar(50) not null, autorizado bool default 'f' not null, id_plano_pgto int2 references plano_pgto not null, data_matricula date default CURRENT_DATE not null, primary key(id_aluno,id_curso,id_polo), FOREIGN KEY (id_cu

[SQL] JOIN syntax

2000-06-25 Thread Oliver Elphick
complex WHERE clause). Is there anything wrong with the syntax, or is it a missing feature? -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1

Re: [SQL] Orderby two different columns

2000-06-23 Thread Oliver Elphick
bmitted > created then resubmitted else created end desc; -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56

Re: [SQL] Merging two columns into one

2000-06-22 Thread Oliver Elphick
u can drop the old table and recreate it with the correct columns and import the data into it from new_table. (You could just rename new_table if it doesn't need to be created with constraints.) -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight