Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoting all table and column names #2

Closed
cmarmo opened this issue Feb 24, 2015 · 7 comments
Closed

Quoting all table and column names #2

cmarmo opened this issue Feb 24, 2015 · 7 comments
Assignees

Comments

@cmarmo
Copy link

cmarmo commented Feb 24, 2015

Hello Mihail,
first of all thanks for your code, you saved my life! :)
I just want to report a problem with quotes in the output sql file.
Column names are quoted when the table is created but table names are not.
In index creation commands table and columns are not quoted (see attached output example)

DROP TABLE IF EXISTS regionCodes;

CREATE TABLE regionCodes (
    "idregion" serial NOT NULL ,
    "regionName" varchar(45) NOT NULL ,
    "regionCode" varchar(2) NOT NULL ,
    PRIMARY KEY ("idregion")

);
CREATE UNIQUE INDEX "regionCodes_regionName_UNIQUE" ON regionCodes (regionName);
CREATE UNIQUE INDEX "regionCodes_regionCode_UNIQUE" ON regionCodes (regionCode);

This could be produced errors in importing.
If you have time to take a look...

Thanks again for your code!
Chiara

@mihailShumilov mihailShumilov self-assigned this Feb 24, 2015
@mihailShumilov
Copy link
Owner

Hi!

Thanks for feedback, it's really very important for me
I made some changes, now it will works as expected.
Please check it and leave a comment

@cmarmo
Copy link
Author

cmarmo commented Feb 24, 2015

Thanks for your quick answer!
You are almost there... :)
The INSERT into too need quotes

INSERT INTO imformats ("idimformats","format") VALUES 
('1','FITS2D'),
('2','FITS3D'),
('3','JPEG'),
('4','BMP'),
('5','AVI');

@mihailShumilov
Copy link
Owner

Oh, thanks for reply
I fixed it right now

@cmarmo
Copy link
Author

cmarmo commented Feb 24, 2015

Hello,
still me... I restarted from scratch with your last version and I discovered the same problem of case sensitivity in this line

SELECT setval('regionCodes_idregion_seq', 22);

and I fixed it by hand by

SELECT setval('"regionCodes_idregion_seq"', 22);

Is that the good fix?

(sorry for the spare parts bug report)
Chiara

@mihailShumilov
Copy link
Owner

Khm
Your fix looks not so good
I will research this problem

@mihailShumilov
Copy link
Owner

After reading documentation at http://www.postgresql.org/docs/9.4/static/functions-sequence.html
I agree with Your patch
I updated code with Your suggestions

@cmarmo
Copy link
Author

cmarmo commented Feb 26, 2015

It works!
That's wonderful! :)
Thanks a lot!
Chiara

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants