Is there a way to insert a camelcase table name in pgadmin? - postgresql

I have a DB with table names written in underscore format. I want to edit their names and also to be able to name every new table in a camelcase format
Still, whenever I use a query to call a camelcase table name I have to do it using double quotes. I do not want double or single quotes. Only the table name. Is it possible?
I have found a similar post describing 3 possible options about naming a table column in pgAdmin not including what I am looking for.
Also, that was 6 years ago and I am wondering if some things have changed since then, while I have not found any solution yet.

Related

Searching for a user named "Don" with PostgreSQL full text search

We hit a bug with our PostreSQL full text search system where a user whose first name is "Don" was not being included in search results. After some digging, we found that "don" is listed as a stopword in the default full text search dictionary in PostgreSQL (https://github.com/postgres/postgres/blob/master/src/backend/snowball/stopwords/english.stop).
We are using a hosted DB solution so we don't have access to the file system and thus can't create a modified version of the stopword file.
Are there any workarounds for this other than doing a string comparison check? Given that there can be multiple search tokens, it seems pretty bad to have to perform a string comparison of the name fields against every search token.
All the other words in the English stopword file seem pretty reasonable, but I'm really surprised I don't see any other Google/SO results complaining about users named "Don".
Maybe this makes it clear why don is a stopword:
SELECT to_tsvector('english', 'don''t');
to_tsvector
-------------
(1 row)
You wouldn't want to remove that stop word.
Full text search is not useful for proper names.
Normally, trigram indexes are better for that.

TYPO3 Extbase field names with numbers

I’ve got problematic use case:
I’ve got a field something_10_somotherthing in my database, and it seems that extbase experiences some issues mapping $something10Someotherthing to this field, though I don’t know why.
I’m importing the data from a json file into my mysql database 1:1 and mapping it with extbase afterwards, so I’m not that flexible on field names (but I could implement a mapping in my import if needed). I tried mapping the field using the techniques from the documentation (https://docs.typo3.org/typo3cms/ExtbaseFluidBook/8.7/6-Persistence/4-use-foreign-data-sources.html) but even when adding this to ext_typoscript_setup.txt and ext_typoscript_setup.typoscript, nothing happened. Any thoughts?
I think I’ve got an issue because of the 10 and that extbase might not be able to map it properly to a lowerCamelCase name but really unsure about it.
Thanks for any help!
Hi as your property can not automatically maped bacause of the _10_ part. You havr two options
Define an explicit property mapping see https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/4-use-foreign-data-sources.html
Rename your fieldname to something10_somotherthing
Explanation: expbase uses upercase letters as seperators to generate the field name. And numbers are lowercase. So it does not insert an underscore seperator thus ending with field name something10_somotherthing

Postgres. Have to user public.user to query users [duplicate]

This question already has answers here:
Cannot access table without public.table name. Is there a way to get rid of public?
(2 answers)
Closed 7 years ago.
I'm using postgres on heroku with a node app.
I'm connecting to my database no problem and I can query all my other tables no problem
select * from org; works perfectly.
My problem is querying users which are obviously called user
select * from user seems to be returning the postgres database user name.
If I use select * from public.user I get the list of users I've created.
Is there a way of just using user?
I'm sure I've missed something simple.
USER is a reserved word in SQL Standard, thus it also is in PostgreSQL.
You should NOT use that as your table name.
Type select user to see that it will also give you the name of user that holds current conection to the database.
As to your question, there is no way of using just user as a reference to your table.
From documentation, bold emphasis mine:
SQL distinguishes between reserved and non-reserved key words. According to the standard, reserved key words are the only real key words; they are never allowed as identifiers. Non-reserved key words only have a special meaning in particular contexts and can be used as identifiers in other contexts.

Must be possible to filter table names in a single database?

As far as I can tell, the search filter in the navigator will only search available database names, not table names.
If you click on a table name and start typing, it appears that a simple search can be performed beginning with the first letter of the tables.
I'm looking for way to be able to search all table names in a selected database. Sometimes there can be a lot of tables to sort through. It seems like a feature that would likely be there and I can't find it.
Found out the answer...
If you type for example *.test_table or the schema name instead of the asterisk it will filter them. The key is that the schema/database must be specified in the search query. The asterisk notation works with the table names as well. For example *.*test* will filter any table in any schema with test anywhere in the table name.
You can use the command
SHOW TABLES like '%%';
To have it always in your tools, you can add it as a snippet to SQL aditions panel on the right.
Then you can always either bring it in your editor and type your search key between %%, or just execute it as it is (It will fetch all the tables of the database) and then just filter using the "filter rows" input of the result set.

How to search for names in a text field in SQL Server

I need to redact proper names from text fields in SQL Server. Let's say I have the following table:
PersonTable
FirstName
LastName
Notes
I could do this:
UPDATE PersonTable
SET Notes = REPLACE(REPLACE(Notes, FirstName, 'REDACTED'), LastName, 'REDACTED')
That should work fine for the exact match condition, but what if someone has misspelled first or last name in the Notes field, or worse yet, used a nick-name like Jim?
I think Full Text searching using Contains is good for this sort of thing where the deviation is meaning or derivation-based, but will it work for names? Even if it worked for finding rows where Notes contained a name, I don't think it works with the Replace scenario.
I have also considered SOUNDEX, but I am also not seeing how to do this using Replace for a text field. The only way I can see using Soundex or something like that would be to split the text field into words and do a comparison on each word. I have to do this on many text fields in very heavily populated tables, so I'm not excited about doing that if there's a better way.
Does anyone have experience doing something like this?
Thanks