473,657 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DIfferent ORDER BY behaviour in 7.4.2

Hi,
I am seeing a different sorting behaviour for varchar columns in
Postgres 7.4.2.

postgres 7.4.2 is ignoring case for varchar columns for "ORDER BY"
commands where as 7.2.2 is not.

I am in a situation where I need to do diff from the select outputs of
two databases - one in 7.2.2 and one in 7.4.2.

So, is there any way I can force the ORDER BY to ignore case or
to not ignore case ?

The test results are as follows:

CREATE TABLE testSort (
testing varchar(32));

INSERT INTO testSort VALUES ('abc');
INSERT INTO testSort VALUES ('Abd');
INSERT INTO testSort VALUES ('aBc');
INSERT INTO testSort VALUES ('Cbaa');

select * from testSort order by testing;

In Postgres 7.2.2:
------------------
TEST=# select * from testSort order by testing;
testing
---------
Abd
Cba
aBc
abc
(4 rows)
In Postgres 7.4.2:
------------------
TEST=# select * from testSort order by testing;
testing
---------
aBc
abc
Abd
Cbaa
(4 rows)
Thanks in advance,
guna.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
4 1444
Gunasekaran Balakrishnan <gu**@motorola. com> writes:
I am seeing a different sorting behaviour for varchar columns in
Postgres 7.4.2.
postgres 7.4.2 is ignoring case for varchar columns for "ORDER BY"
commands where as 7.2.2 is not.


Check your locale settings.

IIRC, --enable-locale was not default in 7.2 days, but it is default
(in fact mandatory) now. So it's possible that the 7.2 installation
doesn't have locale support at all and is defaulting to C-locale
behavior. If your 7.2 was built with locale support, then it was
probably initdb'd under a different locale setting than your 7.4 was.
In 7.4 you can just do "show lc_collate" to check, but in 7.2 I think
you have to use pg_controldata (or in a pinch, "strings pg_control")
to find out what locale it's using.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #2
Thanks a lot Tom !!
Locale settings was the problem.

Thanks,
guna.
Tom Lane wrote:
Gunasekaran Balakrishnan <gu**@motorola. com> writes:

I am seeing a different sorting behaviour for varchar columns in
Postgres 7.4.2.
postgres 7.4.2 is ignoring case for varchar columns for "ORDER BY"
commands where as 7.2.2 is not.


Check your locale settings.

IIRC, --enable-locale was not default in 7.2 days, but it is default
(in fact mandatory) now. So it's possible that the 7.2 installation
doesn't have locale support at all and is defaulting to C-locale
behavior. If your 7.2 was built with locale support, then it was
probably initdb'd under a different locale setting than your 7.4 was.
In 7.4 you can just do "show lc_collate" to check, but in 7.2 I think
you have to use pg_controldata (or in a pinch, "strings pg_control")
to find out what locale it's using.

regards, tom lane

Nov 23 '05 #3
Hi,

I see that one of the bug fixes in 7.4.3 is:

"Fix temporary memory leak when using non-hashed aggregates (Tom)"

I am still using 7.4.2, and want to find out if I need to upgrade to 7.4.3.

I did not quite understand the bug, or find a way to re-produce this in the
mailist archives.

Can someone point me to the test case which can re-produce this problem.

Thanks a lot in advance,
guna.

Gunasekaran Balakrishnan wrote:
Thanks a lot Tom !!
Locale settings was the problem.

Thanks,
guna.
Tom Lane wrote:
Gunasekaran Balakrishnan <gu**@motorola. com> writes:

I am seeing a different sorting behaviour for varchar columns in
Postgres 7.4.2.
postgres 7.4.2 is ignoring case for varchar columns for "ORDER BY"
commands where as 7.2.2 is not.


Check your locale settings.
IIRC, --enable-locale was not default in 7.2 days, but it is default
(in fact mandatory) now. So it's possible that the 7.2 installation
doesn't have locale support at all and is defaulting to C-locale
behavior. If your 7.2 was built with locale support, then it was
probably initdb'd under a different locale setting than your 7.4 was.
In 7.4 you can just do "show lc_collate" to check, but in 7.2 I think
you have to use pg_controldata (or in a pinch, "strings pg_control")
to find out what locale it's using.
regards, tom lane

Nov 23 '05 #4
Gunasekaran Balakrishnan wrote:
Hi,

I see that one of the bug fixes in 7.4.3 is:

"Fix temporary memory leak when using non-hashed aggregates (Tom)"

I am still using 7.4.2, and want to find out if I need to upgrade to 7.4.3.

I did not quite understand the bug, or find a way to re-produce this in the
mailist archives.

Can someone point me to the test case which can re-produce this problem.


No, just upgrade, it is very easy, just stop, install, restart.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.ph a.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2676
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following possibility and because the languages do not specify the order of evaluation, doing so was an error. int B::f ( int i, int j = i + 1 ) { // j defaults to i + 1
8
10639
by: Lian | last post by:
Hi all, It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them? Can i use them at the same time and set different values? Thank you for suggestions!
13
2845
by: subnet | last post by:
What does the standard say about this: #include <stdio.h> void somefunc(int a, int b, int c) { printf("%d %d %d\n", a, b, c); } int main(void) { int i = 5;
4
6193
by: | last post by:
I have earlier used an HttpModule that did URL rewrites on the BeginRequest event. Now I am trying to use the same module in a different application on a new and upgraded machine (winxp sp2). The Module is registered via Web.config. The registration is OK. When asking for an existing .aspx page, the eventhandler is called as it should. HOWEVER - if the request url is for a non-existant file, I get a 404 - file
27
2661
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to provide a "one obvious way" to do enumerations in Python. > >>> from enum import Enum > >>> day = Enum('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
3
5404
by: Patrick [MSFT] | last post by:
Let me preface this with the goal I'm trying to achieve is mimic a feature of another language (Dexterity used by Microsoft Dynamics) and so while a filling a drop down list is a workable solution I'd rather do it like Microsoft Dynamics does and use separate textbox and lookup button. What I have is, simply, is a C# winform, a textbox and a pushbutton. On the textbox, on the validating event of the textbox I check my customer table...
9
8344
by: Allen | last post by:
In a static library, there is a static variable definition. static CLogger::mapFile; In both EXE and DLL, I use the same code. CLogReader uses CLogger::mapFile to do some work. CLogReader logReader; But the result is different.
0
1431
by: mmones | last post by:
Hello, I 'm working with an IBM DB2 V9 database via ODBC/CLI. I've got a problem with different lock behaviour in the following constellation / configuration. 1) connection C1 and connection C2 access table T1 2) STMT1 is a statementhandle of C1 and STMT2 is a statementhandle of C2 3) the TXN_ISOLATION_LEVEL is SQL_TXN_READ_COMMITTED (Cursor
54
3915
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of parentheses. 1) "The order of evaluation of subexpressions is determined by the precedence and grouping of operators."
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.