Re: [HACKERS] [BUGS] Bug #659: lower()/upper() bug on

2002-06-12 Thread Enke, Michael

Tatsuo Ishii wrote:
> 
> > > > > There are "full width alphabets" in Japanese. Thoes include not only
> > > > > ASCII letters but also some European characters.
> > > >
> > > > Are these ASCII and European characters uppercased in some
> > > > Japanese-specific way ?
> > >
> > > Probably not, but I'm not sure since my Linux box does not have *.utf8
> > > locales.
> >
> > Could you give me the UTF-8 bytecode for one japanese upper case char and
> > for the same char the lower case?
> > I will check in de_DE locale if this translations works.
> 
> Ok, here is the data you requested. The first three bytes (0xefbca1)
> represents full-width capital "A", the rest three bytes (0xefbd81)
> represents full-width lower case "a".

Thank you for the data, it is working in ja_JP.utf8 and in de_DE.utf8
I send you my test program as attachment.

Regards,
Michael



#include 
#include 
#include 
#include 
#define LEN 7

int main() {
  char readInByte[LEN], writeOutByte[LEN]; // holds the character bytes
  const char *readInByteP[] = {readInByte};// help pointer
  wchar_t readInWC[LEN], writeOutWC[LEN];  // holds the wide characters
  const wchar_t *writeOutWCP[] = {writeOutWC}; // help pointer
  wctrans_t wctransDesc;   // holds the descriptor for conversion
  int i, ret;
  //const char myLocale[] = "ja_JP.utf8";
  const char myLocale[] = "de_DE.utf8";
  char *localeSet;

  readInByte[0] = 0xef; readInByte[1] = 0xbc; readInByte[2] = 0xa1; // full-width A 
(upper) in UTF-8
  readInByte[3] = 0xef; readInByte[4] = 0xbd; readInByte[5] = 0x81; // full-width a 
(lower) in UTF-8
  readInByte[6] = 0;

  // print out the input
  printf("full-width A (upper) UTF-8: %hhx %hhx %hhx\n", readInByte[0], readInByte[1], 
readInByte[2]);
  printf("full-width a (lower) UTF-8: %hhx %hhx %hhx\n", readInByte[3], readInByte[4], 
readInByte[5]);

  if((localeSet = setlocale(LC_CTYPE, myLocale)) == NULL) { perror("setlocale"); 
exit(1); }
  else printf("locale set: %s\n", localeSet);
  ret = mbsrtowcs(readInWC, readInByteP, LEN, NULL); // convert bytes to wide chars
  printf("number of wide chars: %i\n", ret);
  wctransDesc = wctrans("tolower");// get descriptor for wc operation
  if(wctransDesc == 0) { perror("wctransDesc"); exit(1); }

  // make the transformation according to descriptor
  i=0; while((writeOutWC[i] = towctrans(readInWC[i], wctransDesc)) != L'\0') i++;
  
  ret = wcsrtombs(writeOutByte, writeOutWCP, LEN, NULL); // convert wide chars to bytes
  printf("number of bytes: %i\n", ret);

  // print out the result
  printf("full-width A tolower(): %hhx %hhx %hhx\n", writeOutByte[0], 
writeOutByte[1], writeOutByte[2]);
  printf("full-width a tolower(): %hhx %hhx %hhx\n", writeOutByte[3], 
writeOutByte[4], writeOutByte[5]);

  return 0;
}



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[BUGS] Bug #691: CREATE TABLE AS ignores explicit column names with UNION

2002-06-12 Thread pgsql-bugs

Todd Reed ([EMAIL PROTECTED]) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
CREATE TABLE AS ignores explicit column names with UNION

Long Description
CREATE TABLE AS ignores explicitly specified column names when the query contains a 
UNION.  This is illustrated in the example below.

I am using 7.2.1 on RedHat Linux 7.2.

Sample Code
template1=# create table foo (
template1(# x   int,
template1(# y   int,
template1(# z   int
template1(# );
CREATE
template1=# create table bar (
template1(# a   int,
template1(# b   int,
template1(# c   int
template1(# );
CREATE
template1=# create table snafu (s, u, t) as
template1-# select x, y, z from foo union select a, b, c from bar;
SELECT
template1=# create table spam (s, u, t) as
template1-# select x, y, z from foo;
SELECT
template1=# select * from snafu;
 x | y | z
---+---+---
(0 rows)


template1=# select * from spam;
 s | u | t
---+---+---
(0 rows)

No file was uploaded with this report


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [BUGS] Bug #691: CREATE TABLE AS ignores explicit column names with UNION

2002-06-12 Thread Tom Lane

[EMAIL PROTECTED] writes:
> CREATE TABLE AS ignores explicitly specified column names when the query contains a 
>UNION.  This is illustrated in the example below.

Good catch!  If you need a fix immediately, I think the attached patch
will do the trick.  (Line numbers are for current sources, but it should
patch cleanly into 7.2.*)  I have not tested it extensively though, so
there might be side-effects...

regards, tom lane

*** src/backend/parser/analyze.c.orig   Tue May 28 18:15:42 2002
--- src/backend/parser/analyze.cWed Jun 12 21:49:56 2002
***
*** 2212,2219 
--- 2212,2227 
qry->isBinary = FALSE;
}
  
+   /*
+* Any column names from CREATE TABLE AS need to be attached to both the
+* top level and the leftmost subquery.  We do not do this earlier
+* because we do *not* want the targetnames list to be affected.
+*/
if (intoColNames)
+   {
applyColumnNames(qry->targetList, intoColNames);
+   applyColumnNames(leftmostQuery->targetList, intoColNames);
+   }
  
/*
 * As a first step towards supporting sort clauses that are

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[BUGS] to_date problem.

2002-06-12 Thread lewwid

select to_date('December 12 2002','Month dd ');
  to_date  

 2002-12-02

select to_date('January 12 2002','Month dd ');   
  to_date  

 0005-06-24 <- Problem right there.


select to_date('January 12, 2002','Month dd, ');
  to_date  

 2002-01-01   <-- It should be 2002-01-12

select to_date('December 12, 2002','Month dd ');
  to_date  

 2002-12-02


For some reason it's getting caught up on January.  I know these dates are
Unambiguous however I think there might be a bug there.

It would be my first bug ;)




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])