Re: [SQL] Creating timestamps in queries?
Hi Rob, Try this: select * from blah where stamp >= now()::date - 7; I think it should work. /Patrik Kudo On Mon, 10 Jul 2000, Rob S. wrote: > Hi all, > > I would like to say, > > "select * from blah where stamp >= 7 days ago" > > ...where the "days ago" is calculated at query time; meaning that its not > hardcoded into the query as a date string. Is this possible?
[SQL] SQL-92 SQLSTATE in PostgreSQL ?!
Hi, Is there SQL-92 SQLSTATE or SQL-96 SQLCODE implemented in PostgreSQL (I use version 7.0 on SuSe Linux 6.4) ? If so, how to take the value of it in stored procedures (written in PL/pgSQL or C) In documentation I found only a short describtion of sqlca In ecpg. Thanks in advance Adam
[SQL] Checking for existence of table
Hello, Is it possible to check for the existence of a table within PL/pgSQL? Would select count(*) from pg_class where relname='name' and reltype='0' be the answer to this question? -- Paul McGarrymailto:[EMAIL PROTECTED] Systems Integrator http://www.opentec.com.au Opentec Pty Ltd http://www.iebusiness.com.au 6 Lyon Park RoadPhone: (02) 9878 1744 North Ryde NSW 2113 Fax: (02) 9878 1755
[SQL] Change type of column
Hello, how can I change the type of a column, e.g. from varchar() to text? Or is it possible to drop (i.e. delete) a column without creating a new table from the old one but without that column, dropping the old table and renaming the old to the new? Thanks, Volker Paul
Re: [SQL] Supported Encoding
> Does Postgresql support only EUC? Basically, I am trying to save > international > fonts to Postgresql, so I'm trying to find out what exactly I need to do. I'd suggest you try the Unicode UTF-8 encoding. It supports many languages, including Japanese of course, and needs no modification of existing programs, if you don't rely on character counting for output formatting. Volker Paul
RE: [SQL] Change type of column
I think this is in the FAQ. I was reading it last nite and I believe there's something in there that might be relevant. - r > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf > Of Volker Paul > Sent: July 11, 2000 12:32 AM > To: [EMAIL PROTECTED] > Subject: [SQL] Change type of column > > > Hello, > > how can I change the type of a column, e.g. from varchar() to text? > Or is it possible to drop (i.e. delete) a column without > creating a new table from the old one but without that column, > dropping the old table and renaming the old to the new? > > Thanks, > > Volker Paul >
Re: [SQL] Supported Encoding
Volker, Thank you, I was using UTF8 because I am accessing the database via JDBC, and Java's default encoding is UTF8. I wasn't sure about whether it was a right thing to do or not. Thank you very much. I really appreciate your help! Tony Nakamura - Original Message - From: Volker Paul <[EMAIL PROTECTED]> To: Tony Nakamura <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 11, 2000 2:38 AM Subject: Re: [SQL] Supported Encoding > > Does Postgresql support only EUC? Basically, I am trying to save > > international > > fonts to Postgresql, so I'm trying to find out what exactly I need to do. > > I'd suggest you try the Unicode UTF-8 encoding. It supports many > languages, including Japanese of course, and needs no modification > of existing programs, if you don't rely on character counting > for output formatting. > > Volker Paul >
Re: [SQL] Creating timestamps in queries?
I think you meant: select * from blah where stamp >= now() - '7days'::interval; You can also try: select * from blah where age( now(), stamp ) < '7days'::interval; Frank At 09:07 AM 7/11/00 +0200, you wrote: >Hi Rob, > >Try this: > >select * from blah where stamp >= now()::date - 7; > >I think it should work. > >/Patrik Kudo > >On Mon, 10 Jul 2000, Rob S. wrote: > >> Hi all, >> >> I would like to say, >> >> "select * from blah where stamp >= 7 days ago" >> >> ...where the "days ago" is calculated at query time; meaning that its not >> hardcoded into the query as a date string. Is this possible? > > >
RE: [SQL] Creating timestamps in queries?
My friends, you are truly life-savers. Thanks very much! How on Earth do you know this stuff? =) I saw all of these in the User's Guide (re: now(), interval keyword, etc.), but in no way would figure this was how they were put together! Aside from the few in the FAQ, is there a list of commonly-done queries? There are some for SELECT and whatnot, but maybe asking for that for these far-out ones is too much. Thanks again all ;) - A very grateful Rob Slifka > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf > Of Frank Bax > Sent: July 11, 2000 5:40 PM > To: [EMAIL PROTECTED] > Subject: Re: [SQL] Creating timestamps in queries? > > > I think you meant: > > select * from blah where stamp >= now() - '7days'::interval; > > You can also try: > > select * from blah where age( now(), stamp ) < '7days'::interval; > > Frank > > At 09:07 AM 7/11/00 +0200, you wrote: > >Hi Rob, > > > >Try this: > > > >select * from blah where stamp >= now()::date - 7; > > > >I think it should work. > > > >/Patrik Kudo > > > >On Mon, 10 Jul 2000, Rob S. wrote: > > > >> Hi all, > >> > >> I would like to say, > >> > >> "select * from blah where stamp >= 7 days ago" > >> > >> ...where the "days ago" is calculated at query time; meaning > that its not > >> hardcoded into the query as a date string. Is this possible? > > > > > > >