#857 ignoring column alias

Unknown (89)

The statement "select name as surename from person" ignores the alias and returns a column named "name". The (stupid) statement "select if(1=1, name, '') as surename from person" returns the correct column name 'surename'.


  • Rob Manning

    Rob Manning - 2010-04-07

    The bug that you submitted does not contain adequate information to allow us to reproduce the problem. If we cannot reproduce the problem, then the bug will likely not be fixed. Please provide:
    Database Server Name
    Database Server Version
    JDBC Driver Name
    JDBC Driver Version
    JDBC URL (it's ok to obscure the host and port as <host> and <port>)
    JDBC Driver classname

    Until we have this information, the bug will also probably be seen as lower priority than other bugs which do have adequate information to reproduce them.

  • Anders Olsson

    Anders Olsson - 2010-04-15

    I also have this problem, my config:

    Database Server Name: MySQL
    Database Server Version: 5.0.88
    JDBC Driver Name: Connector/J
    JDBC Driver Version: 5.1.6
    JDBC URL (it's ok to obscure the host and port as <host> and <port>): jdbc:mysql://localhost/<dbname>
    JDBC Driver classname: com.mysql.jdbc.Driver

  • Anders Olsson

    Anders Olsson - 2010-04-15

    I have downgraded for now, 3.0.3 does not show this bug.

  • Nobody/Anonymous

    I also have this problem, my config:

    Database Server Name: DB2
    Database Server Version: 9
    JDBC Driver Name: IBM DB2 App Driver
    JDBC Driver Version: ?
    JDBC URL jdbc:db2://<host>:<port>/alboltp
    JDBC Driver classname: com.ibm.db2.jcc.DB2Driver

  • Nobody/Anonymous

    Further info on my previous comment. The column alias is ignored on both my XP box running 3.1.1 and my Vista box on 3.1. On XP I have reverted to 3.0.1 and I no longer have the problem.

  • Anders Olsson

    Anders Olsson - 2011-04-27

    To reproduce:

    create table test (col1 int);
    select col1 as 'Column 1' from test;

    Note that the column in the result view is named col1 instead of Column 1 as is the behavior in version 3.0.3.

    This is on ubuntu 10.10, squirrel 3.2.1 and MySQL but it seems from the comments to be db and operating system independent so my guess is that anyone can reproduce this using the above two statements.

    This also affects csv/xls-export, which keeps me from updating because I create reports for my client this way and I want to show them more human readable names for the columns.

  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2011-08-22

    To reproduce use steps from @andeol comment

    Info about my environment:
    JDBC driver name: MySQL-AB JDBC Driver
    JDBC DRIVER classname: com.mysql.jdbc.Driver
    JDBC version: 4.0
    Driver filename: mysql-connector-java-5.1.15.jar
    URL: jdbc:mysql://localhost:3306/test_db
    DB Server name: MySQL
    DB Server version: 5.1
    Database product version: 5.1.55-community

  • Stefan Willinger

    Please note, that SQuirreL has a Global Preferences to use the column label (aka alias) as column name.

    You can enable this by: Global Preferences => Data Types => "Use column
    labels instead of column names in result headers"

    The defect of export to CSV... is fixed. (thanks for the information)

    Please let us know, if this solve your issue. The changes will be available at the next snapshot release (later then 2011-08-14)


  • Stefan Willinger

    • assigned_to: manningr --> wis775

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks