[SQL] MD5 encrypt

2003-12-24 Thread alvaro
Hi, Is there any function on postgresql that allows to encrypt data when making an Insert statment? Tks a lot, Alvaro ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unreg

Re: [SQL] [GENERAL] Monitoring a Query

2002-09-27 Thread Alvaro Herrera
ronym for "Grand Unified Configuration". -- Alvaro Herrera () "El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens) ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe

Re: [GENERAL] [SQL] function return multiply rows

2002-09-28 Thread Alvaro Herrera
2); insert into vw_teams values (3, 4); select a(test()), b(test()); a | b ---+--- 1 | 2 3 | 4 (2 rows) I suspect the function is being evaluated twice for each row. Maybe there's a better way. -- Alvaro Herrera () La web junta la gente porque no importa que clase de mutante sex

Re: [SQL] CASE not working

2005-03-21 Thread Alvaro Herrera
a "vence" The problem is that the "vence" alias is not available at the time the CASE is evaluated. You need to use the getvencimientosancion() function, or put it in a subselect in case it's expensive to compute (or has side effects). -- Alvaro Herrera (<[EMAIL PRO

Re: [SQL] [HACKERS] Executing Anonymous Blocks

2005-03-28 Thread Alvaro Herrera
On Mon, Mar 28, 2005 at 12:27:18PM +0500, imad wrote: > I want to know is there any way to execute an anonymous PL/pgSQL block > in PostgreSQL. No, there isn't. -- Alvaro Herrera (<[EMAIL PROTECTED]>) Al principio era UNIX, y UNIX habló y dijo: "Hello world\n". No di

Re: [SQL] cost of CREATE VIEW ... AS SELECT DISTINCT

2005-03-29 Thread Alvaro Herrera
stricts the candidate rows, this > >probably isn't going to be very fast. You might be better off > >changing the view to use GROUP BY instead of DISTINCT. > > As far as I can see (via EXPLAIN), both DISTINCT and GROUP BY will > lead to a sequentail scan. Is that correct?

Re: [SQL] asynchrous triggers

2005-03-31 Thread Alvaro Herrera
ess to do something asynchronously using LISTEN/NOTIFY. That is, unless you write your trigger function in C and it calls fork(). Not sure if that would actually work though (and you should forget about accessing the database.) -- Alvaro Herrera (<[EMAIL PROTECTED]>) "Estoy de acuer

Re: [SQL] row-attribute in EXPLAIN-output doesn't match count(*)

2005-04-14 Thread Alvaro Herrera
need to go around and kill -2 such connections from time to > time. It is a Postgres limitation as well. We _could_ make the server "really start the transaction" at the point the first query is issued instead of when the BEGIN is issued. In fact this problem would go away if we

Re: [SQL] Matching the MYSQL "Describe " command

2005-04-24 Thread Alvaro Herrera
m pg_attribute I think it does more or less what you want. The easiest way to know this sort of info is start psql with -E, and then describe a table using \d. It will show you what queries it issued. attrelid is a FK to pg_class.oid, which is a system (therefore hidden) column. -- Alvaro Herr

Re: [SQL] interesting SQL puzzle - concatenating column with itself.

2005-05-08 Thread Alvaro Herrera
alues (666, 2, 'red fox'); select memo_id, textcat(memo_text) from (select * from memos order by memo_id, sequence) as foo group by memo_id; The order is not really guaranteed, though if this is a one-shot thing, you may get away with turning off hashed aggregates. -- Alvaro Herrera (<[EMAIL PROTECTED]>) "There was no reply" (Kernel Traffic) ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Duplicated records

2005-05-25 Thread Alvaro Herrera
nctos as l2 where > l2.numos=lanctos.numos limit 1); That's because you don't have an index on the Oid column. You may want to try using the ctid column instead; it's the physical row position in the table so it doesn't need to scan the whole table each time. HTH, -- A

Re: [SQL] Sum() rows

2005-05-31 Thread Alvaro Herrera
thon to do this. IIRC there was an article on General Bits about this. Search for "running aggregates". I think there is something in issue #23. See #29 as well. -- Alvaro Herrera () "Las cosas son buenas o malas segun las hace nuestra opinión" (Lisias) -

Re: [SQL] using 'zoneinfo' to manipulate dates ...

2005-06-25 Thread Alvaro Herrera
- 20:00:00-04 (1 fila) Not sure if that helps you any. I think you could build a table using this and the fact that "postmaster -d3" prints the whole table of known timezones. (You could extract that bit from the zic files as well.) -- Alvaro H

Re: [SQL] getting back autonumber just inserted

2005-07-07 Thread Alvaro Herrera
equence as parameter. There is a pg_get_serial_sequence() function, to which you give the table name and column name, and it will give you the sequence name. -- Alvaro Herrera () Oh, oh, las chicas galacianas, lo harán por las perlas, ¡Y las de Arrakis por el agua! Pero si buscas damas Que se consuman como ll

Re: [SQL] getting back autonumber just inserted

2005-07-07 Thread Alvaro Herrera
On Thu, Jul 07, 2005 at 08:21:12PM +0200, mail TechEvolution wrote: > hi Alvaro Herrera > > >>You use the currval() function, using the name of the involved sequence > >>as parameter. There is a pg_get_serial_sequence() function, to which > >>you give the table

Re: [SQL] getting back autonumber just inserted

2005-07-07 Thread Alvaro Herrera
nce used in the trigger. Using currval there is no problem, but you already knew that. -- Alvaro Herrera () "Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans) ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Make COUNT(*) Faster?

2005-07-08 Thread Alvaro Herrera
sual Explain. I expect he will show up in pgsql-hackers sometime ... In spanish: http://www.ubiobio.cl/~gpoo/weblog/archives/000397.html -- Alvaro Herrera () "Find a bug in a program, and fix it, and the program will work today. Show the program how to find and fix a bug,

Re: [SQL] Are long term never commited SELECT statements are a problem?

2005-07-21 Thread Alvaro Herrera
oesn't prove that the documentation on the above URL > wrong? Because it says "in the serializable level," which they acquire when you execute "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE". -- Alvaro Herrera () Officer Krupke, what are we to do?

Re: [SQL] update vs unique index

2005-07-25 Thread Alvaro Herrera
on. Usual workaround is issue two updates instead of one, update foo set a = -a where ; update foo set a = -a + 1 where ; The point is to move all unique keys to an unused interval and then move them back, changed all at a time. It'll eventually be fixed, but don't hold your breath. --

Re: [SQL] catch an 'update where false' ?

2005-08-12 Thread Alvaro Herrera
form a > insert into t (c) values 1; > before the update is resolved > > I hoped a trigger before update could help me, but it seems > that if where clause evals to false, triggers are not called.. Triggers FOR EACH ROW are called once for each updated row. I think you could tr

Re: [SQL] catch an 'update where false' ?

2005-08-14 Thread Alvaro Herrera
added in release 7.4. -- Alvaro Herrera () It does it in a really, really complicated way why does it need to be complicated? Because it's MakeMaker. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] A Table's Primary Key Listing

2005-08-22 Thread Alvaro Herrera
s in a > better way, but nothing was found than D'Arcy's query: There's a PL/pgSQL function, which was posted to the spanish list: http://archives.postgresql.org/pgsql-es-ayuda/2005-08/msg00644.php Not sure if it qualifies as "better" or "worse" for you. -

Re: [SQL] Negative lookbehind assertions in regexs

2005-09-03 Thread Alvaro Herrera
have not only our own code, but also Perl's engine, Python's, Tcl's, and PHP's, available through the PLs. That's more than enough, I'd say. -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com "I call it GNU/Li

Re: [SQL] POSIX Regular Expression question

2005-09-05 Thread Alvaro Herrera
ect 'á' ~ '[a-z]'; ?column? -- f (1 fila) alvherre=# select 'á' ~ '[[:alpha:]]'; ?column? -- t (1 fila) -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com "En las profundidades de nuestro inconsciente hay una obse

Re: [SQL] Panic: PageAddItem: Corrupted page pointers

2005-09-11 Thread Alvaro Herrera
the page is corrupt. The fact that you are using an unsupported version does not help you get a lot of support ... Also, note that this is quite off-topic for pgsql-sql. -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com Este mail se entrega garantizadamente 100%

Re: [SQL] alter sequence + subqueries

2005-09-16 Thread Alvaro Herrera
ated sequence so that any further records to be > inserted into that table resume numbering correctly. The statement I > attempted was: > > ALTER SEQUENCE foo_id_seq > RESTART WITH (SELECT max(id) FROM foo); > > Is this syntax correct and supported? No, but you could call

Re: [SQL] sysid

2005-11-23 Thread Alvaro Herrera
ber. > Is there a way to set the user and group number? No -- fix the code. Just curious, how can user code depend on the SYSIDs? I don't see a way. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Cus

Re: [SQL] Changing auth type in pg_hba.conf ineffective. Why?

2005-11-24 Thread Alvaro Herrera
on? What message do you get if you try to connect while postmaster is down? I'm just trying to make sure you are connecting to the postmaster you think you are ... -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development

Re: [SQL] Need SQL Help Finding Current Status of members

2005-12-16 Thread Alvaro Herrera
EXPLAIN query; to see how it would be executed, and EXPLAIN ANALYZE query; to see the above plus the real numbers that the executor got after executing it (number of times each loop was executed, time spent at each execution step, etc). Read the ANALYZE page to see how are these things s

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-18 Thread Alvaro Herrera
Note that while reordering, CLUSTER also gets rid of dead tuples, so if you cluster you don't need to vacuum. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-18 Thread Alvaro Herrera
Tom Lane escribió: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Note that while reordering, CLUSTER also gets rid of dead tuples, so if > > you cluster you don't need to vacuum. > > Just for the record, that behavior is seriously broken: it violates > MV

Re: [SQL] Question on indexes

2005-12-19 Thread Alvaro Herrera
sense to think of descending indexes.) -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? ht

Re: [SQL] DISTINCT with NULLs and INT fields

2005-12-28 Thread Alvaro Herrera
t sentence (and the second one as well -- they are exactly equivalent) exemplifies that there isn't an implicit typecase from text to integer. If you use single quotes instead of an explicit cast, the literal is assumed to be of type "unknown", which _can_ be casted automatically to

Re: [SQL] For update

2006-01-16 Thread Alvaro Herrera
Ottó Havasvölgyi wrote: > What does this do exactly: > > select * from where for update; > > Will be locked all the tuples in all tables it retrieves? Yes. > In 8.0.5 this did not work for me. How did it not work? Was any error message emitted? What is the view defin

Re: [SQL] For update

2006-01-16 Thread Alvaro Herrera
the exact message unfortunately. Sure, I can try it. Show us the definition and tell us what version are you using. -- Alvaro Herrerahttp://www.PlanetPostgreSQL.org "People get annoyed when you try to debug them." (Larry Wall)

Re: [SQL] psql in the command line

2006-01-25 Thread Alvaro Herrera
la;'| > psql logdb" > ERROR: syntax error at or near "/" at character 16 > LINE 1: copy test from /data/log/bla; This is clearly not the same line. The quotes are not in the same position as in the line above. su - postgres -c "psql logdb -c 'copy test fro

Re: [SQL] how is searchable email archive on

2006-01-31 Thread Alvaro Herrera
Jacob Costello wrote: > Has anyone tried using a postgres based solution for archiving email for > regulatory purposes ? I don't know about regulatory purposes, but the Oryx software is designed for that: http://www.oryx.com (or .net, don't remember) --

Re: [SQL] Does PostgreSQL support job?

2006-02-01 Thread Alvaro Herrera
; feature is managed differently from a RDBMS to another. I was amused when I read the MySQL news in LWN.net, because most comments were things like "what the hell has this half-baked feature has to do in a RDBMS anyway". http://lwn.net/Articles/167895/ -- Alvaro Herrera

Re: [SQL] no notnull values, invalid stats?

2006-02-06 Thread Alvaro Herrera
d you translate it? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Alvaro Herrera
RTFM > > I apologize for my lack of knowledge, but what is "RTFM"? "Read The Fine Manual" If you hear that the F means something else, don't listen!! ;-) -- Alvaro Herrerahttp://www.CommandPrompt.com/ The Postg

Re: [SQL] After Trigger assignment to NEW

2006-02-24 Thread Alvaro Herrera
BEFORE trigger would alter the stored tuple, which is not what Achilleus wants AFAIU. I think the desired effect can be had by having DBMirror check the source relation of the inserted tuple (There is a hidden attributa called tableoid IIRC that can be used for that,

Re: [SQL] Relation 0 does not exist

2006-02-25 Thread Alvaro Herrera
bugs in this ancient version caused this particular problem. I doubt you will find much people trying to figure it out; instead, you should be looking into doing an upgrade rather soonish. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company

Re: [SQL] Index to support LIKE '%suffix' queries

2006-02-25 Thread Alvaro Herrera
is possible to create a functional index on the reverse of the string. You need to also reverse the patter at query-time as well. This will make the % be at the end of the pattern, making it an indexable condition. Whether or not this beats tsearch2 is something you should investigate ... -- Alvar

Re: [SQL] regarding grant option

2006-03-01 Thread Alvaro Herrera
ype too many commands, you can write a little shell script to do it for you. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- T

Re: [SQL] regarding grant option

2006-03-01 Thread Alvaro Herrera
AKHILESH GUPTA wrote: > thank you very much sir for your valuable suggestion, > but i am talking about direct database query...! There is none that can help you here, short of making a function in PL/pgSQL or other language ... > On 3/1/06, Alvaro Herrera <[EMAIL PROTE

Re: [SQL] Problems with disabling triggers in Postgres 7.3.9

2006-03-09 Thread Alvaro Herrera
catalogs are delicate stuff; there are some caches that must be maintained in a coherent manner. Usually the catalogs do not follow MVCC rules to the letter. The "UPDATE pg_class" was used by pg_dump at some point, but it was only a hack and I wouldn't expect it to work correctl

Re: [SQL] Permission to Select

2006-03-13 Thread Alvaro Herrera
not the "salary" > column. If I understand clearly, the patch he posted modified things so that if the user issued an UPDATE command, the SELECT permission was required as well. Thus a user with UPDATE privileges but no SELECT was not allowed to execute t

Re: [SQL] Update value to "the first character is capital and the rest is small"

2006-03-13 Thread Alvaro Herrera
or that. alvherre=# select initcap('GU & WEI. NAN (CE SHI) & TOMMORROW'); initcap Gu & Wei. Nan (Ce Shi) & Tommorrow (1 row) -- Alvaro Herrerahttp://www.CommandPrompt.com/ P

Re: [SQL] Savepoint/Rollback in functions

2006-03-14 Thread Alvaro Herrera
ock which has an EXCEPTION clause, an implicit SAVEPOINT is executed. If any exception (read: error) is found while executing the block, the savepoint will be automatically rolled back and control passed to the EXCEPTION block. HTH, -- Alvaro Herrerahttp://www.C

Re: [SQL] have you feel anything when you read this ?

2006-03-20 Thread Alvaro Herrera
Achilleus Mantzios wrote: > dynacom=# SELECT '\000\150\145\154\154\157'::text; > text > -- > > (1 row) > > dynacom=# > > Oops! text is not bytea. alvherre=# SELECT $$\000\150\145\154\154\157$$::bytea; bytea --- \

Re: [SQL] have you feel anything when you read this ?

2006-03-20 Thread Alvaro Herrera
Achilleus Mantzios wrote: > O Alvaro Herrera ?? Mar 20, 2006 : > > > text is not bytea. > > > > alvherre=# SELECT $$\000\150\145\154\154\157$$::bytea; > >bytea > > --- > > \000hello > > (1 fila) > > Sure, but we are

Re: [SQL] have you feel anything when you read this ?

2006-03-20 Thread Alvaro Herrera
Eugene E. wrote: > Alvaro Herrera wrote: > >text is not bytea. > > source says: > > typedef text varlena; > typedef bytea varlena; This means that as far as the C type system is concerned, both bytea and text are treated as "struct varlena". It doesn't m

Re: [SQL] problem comparing strings when different cluster / database encoding

2006-04-05 Thread Alvaro Herrera
fact that CREATE DATABASE allows you to create a database with an encoding different from the one defined by initdb. The conclusion is that you should create your databases using UTF-8 encoding if you are using cs_CZ.UTF-8, otherwise it won't work as expected. -- Alvaro Herre

Re: [SQL] concatenation with a null column (using ||) nulls the result?

2006-04-10 Thread Alvaro Herrera
atenation, try SELECT cabinets_name || ' - ' || COALESCE(cabinets_description, '') AS concat FROM cabinets WHERE cabinets_datacenters = 2; I'm assuming cabinets_name is NOT NULL, so it doesn't need COALESCE. -- Alvaro Herrerahttp:/

Re: [SQL] trigger to enforce FK with nulls?

2006-04-12 Thread Alvaro Herrera
George Young wrote: > Since foreign keys per se can't do this, I presume the way > is to use triggers, though I have not used triggers before. Says who? Just don't specify NOT NULL on the referencing column. -- Alvaro Herrerahttp://www.Comman

Re: [SQL] "could not open file" issue

2006-04-24 Thread Alvaro Herrera
t;: No such file or directory Are the files in pg_clog close to the vicinity of 0BC9? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 9: In ve

Re: [SQL] "could not open file" issue

2006-04-24 Thread Alvaro Herrera
Daniel Caune wrote: > > > De : Alvaro Herrera [mailto:[EMAIL PROTECTED] > > > > Daniel Caune wrote: > > > > > > select count(*) from eventplayerleaveroom; > > > ERROR: could not access status of transaction 3164404766 > > > DET

Re: [SQL] "could not open file" issue

2006-04-24 Thread Alvaro Herrera
my file system's health on > the next boot. If you experienced memory corruption, it would be wise to run some hardware diagnosys tools, just to be sure. For example memtest86, badblocks, etc. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Comp

Re: [SQL] Creating nested functions with plpgsql

2006-05-07 Thread Alvaro Herrera
output_day DATE; BEGIN; output_day = SELECT inner_function(params_to_create_date); -- do something in main function that uses inner function several -- times. END; $$ language plpgsql; -- Alvaro Herrerahttp://www.CommandPrompt.com/ The Po

Re: [SQL] Add column and specify the column position in a table

2006-05-18 Thread Alvaro Herrera
d; > > > > > > I am looking for similar things in postgresql to add a new column to the > > correct position in a table. > > There's no similar thing in PostgreSQL. You have to duplicate the table > to do it. ... which is the same

Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-28 Thread Alvaro Herrera
andi wrote: > I have seen this is very drawback of our beloved postgres databases, > postgres do not support sql 2003 standards, > > I hope soon we can support this standards. Hmm. True. It is also true that we'll be there sooner if you help out. -

Re: [SQL] SELECT DISTINCT too slow

2006-06-01 Thread Alvaro Herrera
e table. I assume you do have the other table, don't you? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] SELECT DISTINCT too slow

2006-06-01 Thread Alvaro Herrera
(key from pair key => value) > Value (value from pair key => value) > > So I want the get the list of keys used in the table. The plan you get is the most efficient possible for that query. If you had a table of possible keys (which should of course be FK o

Re: [SQL] SELECT DISTINCT too slow

2006-06-01 Thread Alvaro Herrera
Miroslav ?ulc wrote: > The GROUP BY is really fast :-) Doh! How does it do it? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 1:

Re: [SQL] Am I crazy or is this SQL not possible

2006-06-01 Thread Alvaro Herrera
azon? Maybe they wanted to know if you are aware of common non-standard tricks for whatever RDBMS they use. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadca

Re: [SQL] Problem w/ Join... Using (...) Syntax

2006-06-26 Thread Alvaro Herrera
on JOIN t_employee ON (t_employee.employee_id = t_inspection.inspector_id) -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 3: Have you chec

Re: Fwd: [SQL] Start up question about triggers

2006-06-27 Thread Alvaro Herrera
ike Slony. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomai

Re: [SQL] SELECT substring with regex

2006-07-10 Thread Alvaro Herrera
aight on the real life. I'd expect a bit of curvature but I think that's too much. Sorry for the offtopic :-) -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Alvaro Herrera
s they are going to release Real Soon Now. Maybe you could help them with the beta testing if that's what they need. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---

Re: [SQL] Rows with exclusive lock

2006-07-22 Thread Alvaro Herrera
#x27;t help with this. Why? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Rows with exclusive lock

2006-07-23 Thread Alvaro Herrera
Martin Marques escribió: > On Sat, 22 Jul 2006, Alvaro Herrera wrote: > > >Martin Marques escribió: > >>Is it posible to get an exclusive (read/write) lock on certain rows? I > >>don't want to block the whole table, only certain rows, but I want it to > >

Re: [SQL] function returning a cursor and a scalar

2009-07-13 Thread Alvaro Herrera
ram and then make the function > explicitly RETURN a refcursor? Why wouldn't you just use two OUT params? BTW how do you plan on returning the number of matches? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Devel

Re: [SQL] Bit by "commands ignored until end of transaction block" again

2009-07-24 Thread Alvaro Herrera
is context not all transactions are equal :-( (The problem, as we found out, is that the function must always have control at the same level of transaction nestedness in SPI; you can't just let the user define and release savepoints arbitrarily.) -- Alvaro Herrera

Re: [SQL] mail alert

2009-08-13 Thread Alvaro Herrera
27;t block the database system just because your mail server is down - the email can be sent on whatever schedule fits the listener program - the listener client can run elsewhere, not only in the database server - any further external processing can take place at that time, wit

Re: [SQL] mail alert

2009-08-13 Thread Alvaro Herrera
ur system is going to be receiving notifications fairly frequently, it is probably better to stay with polling. (This is what Skype's replication system does, and Hannu Krossing says "what, are you going to optimize for the time when the server is idle?") -- Alvaro Herrera

Re: [SQL] [GENERAL] Data audit trail techniques in postgresql

2009-08-27 Thread Alvaro Herrera
Nathaniel Smith wrote: > What do others use to accomplish this? Do most pg users just write > triggers by hand? Or is there some nice auditing module that Google > just isn't revealing to me? I think tablelog (to be found in pgfoundry too) is the most commonly used audit modul

Re: [SQL] [GENERAL] Data audit trail techniques in postgresql

2009-08-27 Thread Alvaro Herrera
Rob Sargent escribió: > tablelog doesn't appear any more lively than the OPs audittrail2. Perhaps, but I have heard of people using it successfully recently, whereas Nathaniel reported that audittrail2 seems to have obvious bugs. -- Alvaro Herrera

Re: [SQL] get sequence name from table name

2009-12-04 Thread Alvaro Herrera
Uwe Maiwald wrote: > how to get the name of the sequence that is responsible for setting > the autoincrement value of a tables primary key column? You can use the pg_get_serial_sequence() function. You need the name of the column in addition to the table name though. -- Alvaro H

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Alvaro Herrera
ame but that should get you started. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] WAL-files restore and nextval('PK')

2010-05-03 Thread Alvaro Herrera
alues jump to the logged values, which are necessarily higher than the values they last delivered before the crash. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-sql mailing list (pgsql-sql@postgr

Re: [SQL] How do you do the opposite of regexp_split_to_table?

2010-08-03 Thread Alvaro Herrera
Excerpts from John Gage's message of mar ago 03 16:21:58 -0400 2010: > Grouping by summing numerical fields seems to be straightforward, but > grouping by concatenating text fields escapes my search of the > documentation. You can create a new custom aggregate function that does this. It's p

Re: [SQL] 9.0rc1 - query of view produces unexpected results

2010-09-13 Thread Alvaro Herrera
Excerpts from Nathan Grange's message of sáb sep 11 21:31:04 -0400 2010: > Hello list, > > I don't know if it's me, or maybe even the way I designed these > dependencies, but I'm getting unexpected results when i query a specific > view. > Included are a buildDemo.sql file that will create th

Re: Fwd: [SQL] i want small information regarding postgres

2012-01-08 Thread Alvaro Herrera
Excerpts from Samuel Gendler's message of lun ene 02 08:44:53 -0300 2012: > would someone with the appropriate authority please unsubscribe this > person's email address from this list so we don't all get a bounce message > after every email we send to the list? Thanks. Just did it. In the futu

Re: [SQL] regexp_replace behavior

2012-11-20 Thread Alvaro Herrera
Marcin Krawczyk escribió: > Hi list, > > I'm trying to use regexp_replace to get rid of all occurrences of > certain sub strings from my string. > What I'm doing is: > > SELECT regexp_replace('F0301 305-149-101-0 F0302 {x1} 12W47 0635H > {tt}{POL23423423}', E'\{.+\}', '', 'g') > > so get rid of

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Alvaro Herrera
Dev Kumkar escribió: > But what I am asking here is if an alias name is provided be it upper case, > lower case, or a mix then shouldn't it be preserved as as it is given. All > this talk is when alias names are unquoted, when quoted then its standard > behavior as seen in other databases. Aliase

Re: [SQL] Unique index and unique constraint

2013-07-26 Thread Alvaro Herrera
JORGE MALDONADO escribió: > I guess I am understanding that it is possible to set a unique index or a > unique constraint in a table, but I cannot fully understand the difference, > even though I have Google some articles about it. I will very much > appreciate any guidance. The SQL standard does

Re: [SQL] viewing the description of tables from python DB-API

2006-08-01 Thread Alvaro Herrera
#x27;ll give you the query it uses. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] to get DD-MM-YYYY format of data

2006-08-22 Thread Alvaro Herrera
documentation on the "DateStyle" parameter, noticing that it controls two things at once, input and output of dates. You may also use to_char() or extract() to format the date manually without messing with the configuration. -- Alvaro Herrerahttp://www.Com

Re: [SQL] Create Assertion -- Question from a newbie

2006-08-28 Thread Alvaro Herrera
ough. Well, it's on the SQL standard, so we should look forward to implementing (some form of) it some day. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end

Re: [SQL] Postgres regexp matching failure?

2006-09-05 Thread Alvaro Herrera
o, because the \b is inside the "stop" arm of the |. You need to do *both*, double backslashes and get rid of \b (or at least understand what you actually mean with it ...) -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Postgres regexp matching failure?

2006-09-05 Thread Alvaro Herrera
Mario Splivalo wrote: > On Tue, 2006-09-05 at 10:21 -0400, Alvaro Herrera wrote: > > Mario Splivalo wrote: > > > On Tue, 2006-09-05 at 08:42 -0500, Aaron Bono wrote: > > > > On 9/5/06, Mario Splivalo <[EMAIL PROTECTED]> wrote: > > > > > &

Re: [GENERAL] [SQL] Can we convert from Postgres to Oracle !!???

2006-10-21 Thread Alvaro Herrera
But of course, that begs the question: Why on earth would you want to!!??? > > Cost? > > Extensibility? > > The feeling that you won't at any moment be greeted by men in dark suits > wanting to audit your facilities? > > Using Open Source is cool? Maybe

Re: [SQL] record datatype comparisons

2006-10-31 Thread Alvaro Herrera
select row(1,2) is distinct from row(1,2) ; ?column? -- f (1 fila) Is that what you're after? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)-

Re: [SQL] psql -F

2006-11-16 Thread Alvaro Herrera
with the -F option? This is really a shell question. On those I know, you'd type ^V . (Maybe it would work to use '\t' as well, not sure if psql interprets that.) -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom De

Re: [SQL] Autovaccum

2006-11-30 Thread Alvaro Herrera
m time to time anyway, even if you don't delete anything. The easiest way to do it is let autovacuum do it for you. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)---

Re: [SQL] Select (1-3)

2006-11-30 Thread Alvaro Herrera
Ezequias Rodrigues da Rocha wrote: > Hi list, > > It is possible to make a selection like > > Select (list 1 to 1000); Sure, use the generate_series() function. select * from generate_series(1, 1000); -- Alvaro Herrerahttp://www.CommandPrompt.

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Alvaro Herrera
Marcin Stępnicki wrote: > Now I need to create a query to find hours at which each of the type can > start. So, if it's event A (which take 15 minutes) it can start at: > > 8:00 (to 8:15) > 8:15 (to 8:30) > ( 8:30 to 8:45 is already taken ) > 8:45 (to 9:00) > 9:00 (to 9:15) > 9:15 (to 9:30) > ( 9

Re: [SQL] Droping indexes

2007-01-16 Thread Alvaro Herrera
ept only on one place (for example, the eventackuser could probably be put on a separate table and on this one store just an integer ID). This will make the table and the index on that column a lot smaller. 3. add more disks to your installation 4. research a more effective VACUUM

Re: [SQL] Evaluate a variable

2007-01-26 Thread Alvaro Herrera
Luís Sousa wrote: > Hi, > > Is there anyway to evaluate a variable in plpgsql, like eval on PHP? > Suppose the example: > > my_var:=''some value!''; > a:=''my_var''; > b:= a; > > I already tried b:=EXECUTE a

Re: [SQL] Compilation Error AIX

2007-02-06 Thread Alvaro Herrera
s -Wpointer-arith -Winline > -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing > -I../../../src/include -c -o dynloader.o dynloader.c Where does the src/backend/port/dynloader.c symlink point to? What AIX version is this? GCC version? -- Alvaro Herrera

  1   2   >