Pacman: problem with dependency/package names

I type pacman -Si to get names of dependencies, but when I try to put some of the names into pacman -Si, for example pacman -Si, I get:

error: package '' was not found

Although, when I try sudo pacman -S, it seems to find the package but It says:

resolving dependencies...
looking for conflicting packages...

Packages (1) libpsl-0.21.1-1

So I execute this (omitting the hyphen and the rest of the characters after it I suppose):

pacman -Si libpsl

And I successfully get the info.

I would like to know whether It is somehow possible, without having root access I suppose, to get the name of the package so I can put it in pacman -Si without getting an error.

libpsl provides The former is the package name and the latter is a library provided by the package. Since the package provides it, using pacman -S resolves the package it belongs to. If you want to find the package that includes a library or file, use pacman -F <filename>. You can also use a wildcard search: pacman -Fx*.

What about libgl? Is it also the name of the file or library?

Neither. There are quite a few libraries beginning with libgl*, but the first thing I thought of was mesa that provides mesa-libgl. If you use the commands I mention, you’ll see what I mean.

I executed pacman -Fx libgl and it looks like it shows a lot of packages and files (I see some packages have libgl in their names, lots of files have libgl in their names also) but when I execute sudo pacman -S libgl It lets install just libglvnd. I’m not sure how does it decide what to install.

That’s because libglvnd provides libgl. I think there used to be a separate libgl package.