Re: [SQL] [pgadmin-support] Groups and Roles and Users
On Nov 6, 2006, at 12:18 PM, Ezequias Rodrigues da Rocha wrote: Could someone suggest me how to get a documentation about Groups and Roles and Users ? It would be nice to see a simple and easy documentation (a tutorial could be better, with pgadmin much better). Have you looked in the PostgreSQL docs? Roles aren't pgAdmin specific, afterall. -- Jim Nasby[EMAIL PROTECTED] EnterpriseDB http://enterprisedb.com 512.569.9461 (cell) ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] Question about time
Try this one: SELECT date_trunc('seconds',now())::time; "15:11:42" So it should be select date_trunc('seconds', fecha_hora_factura)::time from nota_venta; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Sent: Thursday, November 16, 2006 2:24 PM To: Judith Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Question about time On Thu, 2006-11-16 at 10:14 -0600, Judith wrote: > Hi everyone I'm doing a query like this: > > SELECT CAST(fecha_hora_factura as time) FROM nota_venta > > and I get: > > 14:16:52.824395 > > the field is timestamp type... I just want the HOUR:MINUTE:SECOND > > the question is how I drop the millisecond?? Take a look at date_trunc() under Date/Time Functions and Operators. Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] Question about time
On Thu, 2006-11-16 at 10:14 -0600, Judith wrote: > Hi everyone I'm doing a query like this: > > SELECT CAST(fecha_hora_factura as time) FROM nota_venta > > and I get: > > 14:16:52.824395 > > the field is timestamp type... I just want the HOUR:MINUTE:SECOND > > the question is how I drop the millisecond?? Take a look at date_trunc() under Date/Time Functions and Operators. Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [SQL] Question about time
Try the to_char() function instead of cast() SELECT to_char(fecha_hora_factura, 'HH:MM:SS') FROM nota_venta Cheers, -p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judith Sent: Friday, 17 November 2006 5:14 AM To: pgsql-sql@postgresql.org Subject: [SQL] Question about time Hi everyone I'm doing a query like this: SELECT CAST(fecha_hora_factura as time) FROM nota_venta and I get: 14:16:52.824395 the field is timestamp type... I just want the HOUR:MINUTE:SECOND the question is how I drop the millisecond?? Thnx in advanced!!! ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
[SQL] Question about time
Hi everyone I'm doing a query like this: SELECT CAST(fecha_hora_factura as time) FROM nota_venta and I get: 14:16:52.824395 the field is timestamp type... I just want the HOUR:MINUTE:SECOND the question is how I drop the millisecond?? Thnx in advanced!!! ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [SQL] Random()
On Thu, Nov 16, 2006 at 06:54:42PM -0200, Ezequias Rodrigues da Rocha wrote: > My bigint field has 20,000 numbers and I'd like to make real random (used > like lottery). If you want _real_ random, you have to use a non-computer source for your randomness. The best you get on a computer is pseudo-random. Often it's very good pseudo-random -- most of the time, good enough for most purposes -- but it isn't true randomness of the sort that is delivered by (for example) particle decay. A -- Andrew Sullivan | [EMAIL PROTECTED] The plural of anecdote is not data. --Roger Brinner ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [SQL] Random()
Just another question. I can trust on this random number ? The rule to it is quite tested ? I am thinking in implementing a function that return allways a random number. What do you think of the trust of this function (random()) ? My bigint field has 20,000 numbers and I'd like to make real random (used like lottery). Regards Ezequias 2006/11/16, A. Kretschmer <[EMAIL PROTECTED]>: am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > I have a bigint collumn and I would like to generate a random number within the > numbers of my column. select from order by random() limit 1; Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
Re: [SQL] Random()
Thank you so much andreas. Regards http://ezequiasrocha.blogspot.com 2006/11/16, A. Kretschmer <[EMAIL PROTECTED]>: am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > I have a bigint collumn and I would like to generate a random number within the > numbers of my column. select from order by random() limit 1; Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
[SQL] convert with libpq
Hi I must convert some records from database. I have table named "langset" in unicode database. When I try use command select convert((SELECT "1" from langset where id_langset=5) using utf_8_to_iso_8859_2) in PGadmin, all is ok, sql return 1 record. But where i execute the same command in libpq I got 0 rows: res=PQexec(conn_lokalne,"select convert((SELECT \"1\" from langset where id_langset=5) using utf_8_to_iso_8859_2)"); printf("%s",PQgetvalue(res,0,0)); What is the problem? ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [SQL] Random()
am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > I have a bigint collumn and I would like to generate a random number within > the > numbers of my column. select from order by random() limit 1; Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[SQL] Random()
Hi list, I have a bigint collumn and I would like to generate a random number within the numbers of my column. Is it possible ? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
Re: [SQL] psql -F
Joe Conway wrote: Try: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F $'\t' That's excellent, but please let me post a different way :) by passing commands from stdin: #!/bin/sh cat <
[SQL] Apoie o estudo das células tronco
Visitem: http://www.michaeljfox.org/ http://www.youtube.com/watch?v=DKVfsjIp98w =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/
Re: [SQL] psql -F
Joe Conway wrote: T E Schmitz wrote: Alvaro Herrera wrote: T E Schmitz wrote: I have written a shell script to export data: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F ' ' How can I specify a TAB character with the -F option? Try: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F $'\t' You're a star - that does the trick! Regards, Tarlika Elisabeth Schmitz ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [SQL] recursive SQL and with clause
On 11/15/06, Christopher Browne <[EMAIL PROTECTED]> wrote: If I recall correctly, Jim Nasby was considering it; he hadn't heard much interest back, and got to other things in the 8.2 cycle. I was working on it for 8.2, but it didn't make it. Mark Cave-Ayland will probably be picking it up for 8.3. -- Jonah H. Harris, Software Architect | phone: 732.331.1300 EnterpriseDB Corporation| fax: 732.331.1301 33 Wood Ave S, 2nd Floor| [EMAIL PROTECTED] Iselin, New Jersey 08830| http://www.enterprisedb.com/ ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] psql -F
T E Schmitz wrote: Alvaro Herrera wrote: T E Schmitz wrote: I have written a shell script to export data: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F ' ' Currently, I am using spaces as field separator but what I really want is tabs. How can I specify a TAB character with the -F option? Sorry for having gone off-topic. I was just hoping something like \t could be passed, too. Try: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F $'\t' see: man bash HTH, Joe ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [SQL] psql -F
Alvaro Herrera wrote: T E Schmitz wrote: I have written a shell script to export data: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F ' ' Currently, I am using spaces as field separator but what I really want is tabs. How can I specify a TAB character with the -F option? This is really a shell question. On those I know, you'd type ^V . True. Ctrl-V works fine on the command-line. (Maybe it would work to use '\t' as well, not sure if psql interprets that.) Unfortunately, it doesn't. As far as I know -F literally wants a character and how I get it in really is a shell question. Sorry for having gone off-topic. I was just hoping something like \t could be passed, too. -- Regards, Tarlika Elisabeth Schmitz ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] psql -F
T E Schmitz wrote: > I have written a shell script to export data: > > psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F ' ' > > Currently, I am using spaces as field separator but what I really want > is tabs. > > How can I specify a TAB character 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 Development, 24x7 support ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
[SQL] psql -F
I have written a shell script to export data: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F ' ' Currently, I am using spaces as field separator but what I really want is tabs. How can I specify a TAB character with the -F option? -- Regards, Tarlika Elisabeth Schmitz ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate